Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PowerRename] variable pattern notation for parent folder #8484

Open
akulmehta opened this issue Dec 8, 2020 · 10 comments
Open

[PowerRename] variable pattern notation for parent folder #8484

akulmehta opened this issue Dec 8, 2020 · 10 comments
Labels
Idea-Enhancement New feature or request on an existing product Product-PowerRename Refers to the PowerRename PowerToy

Comments

@akulmehta
Copy link

akulmehta commented Dec 8, 2020

馃摑 Description

Similar to File Creation Date Replace Notation, have a variable pattern notation $PF (Parent Folder) which can be used in the Replace with: field to add the parent folder name to the output renamed files.

Example

Current directory

鈹斺攢 0
   鈹斺攢 file1.png
鈹斺攢 1
   鈹斺攢 file1.png
鈹斺攢 2
   鈹斺攢 file1.png
   鈹斺攢 file2.png

Perform a regex search like : (.*).png, which captures the filename into variable $1

Replace with: $PF_$1.png

Expected output:

鈹斺攢 0
   鈹斺攢 0_file1.png
鈹斺攢 1
   鈹斺攢 1_file1.png
鈹斺攢 2
   鈹斺攢 2_file1.png
   鈹斺攢 2_file2.png

If you'd like to see this feature implemented, add a 馃憤 reaction to this post.

@ghost ghost added the Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams label Dec 8, 2020
@enricogior
Copy link
Contributor

@akulmehta
what is the scenario for which this feature is a requirement, instead of just going to the parent folder and start PowerRename from there?

@enricogior enricogior added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Product-PowerRename Refers to the PowerRename PowerToy and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Dec 8, 2020
@akulmehta
Copy link
Author

A possible scenario is that maybe the filenames are similar (e.g. above you can see all folders have file1.png as camera's might be producing these serially in folders) but the folder names are what differentiates the files (above I have just put 0, 1, 2 but they could be specific names which might be for example trip names etc). But rather than having them in a nested folder structure if you want to flatten the directory structure, then you cannot do that as the files would be the same filename. Using PowerRename one could append/prepend the folder name to the file name thereby differentiating the files below.

The point is that if the folder name carries some information which you would like to have in the filename. Currently there is no way to do it except maybe using PowerShell.

@enricogior I am not sure if this answers your question so please let me know if I missed something.

@ghost ghost added Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Needs-Team-Response An issue author responded so the team needs to follow up and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Dec 8, 2020
@enricogior enricogior added Idea-Enhancement New feature or request on an existing product and removed Needs-Team-Response An issue author responded so the team needs to follow up Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Dec 13, 2020
@dhyannirav
Copy link

I'd like to do exactly this to put all tracks of music albums in one directory. The tracks are named 01_xxx 02_xxx ... in each folder, so I'd like to prefix them with the parent folder name.

@enricogior enricogior changed the title PowerRename variable pattern notation for parent folder [PowerRename] variable pattern notation for parent folder Feb 9, 2021
@typpos
Copy link

typpos commented Jan 3, 2022

Yes please.

Use case:
Parent folders "Theme 1", "Theme 2", "Theme 3"... "Theme 95".
Each folder contains 130 icons named "01.ico" "02.ico" ...

Objective: Move all ico files into the same folder, but adjust file names to be meaningfully unique , ie, prefix file names with parent folder name, so I can later move all files to the same folder.

@AverageHoarder
Copy link

AverageHoarder commented Nov 11, 2022

I would also love this as a feature. Especially for music. I usually have a .log and a .cue file in album folders and I want them to be named in a specific way.

Example:
Music/Braxton, Anthony/Ninetet (Yoshi's) 1997, Vol. 1 [CD 1]/
-something.log
-something.cue
Music/Braxton, Anthony/Ninetet (Yoshi's) 1997, Vol. 1 [CD 2]/
-something.log
-something.cue

I want them use this syntax:
$ParentDir.cue for .cue files
and
$GrandparentDir - $ParentDir.log for .log files
to end up with

Music/Braxton, Anthony/Ninetet (Yoshi's) 1997, Vol. 1 [CD 1]/
-Braxton, Anthony - Ninetet (Yoshi's) 1997, Vol. 1 [CD 1].log
-Ninetet (Yoshi's) 1997, Vol. 1 [CD 1].cue
Music/Braxton, Anthony/Ninetet (Yoshi's) 1997, Vol. 1 [CD 2]/
-Braxton, Anthony - Ninetet (Yoshi's) 1997, Vol. 1 [CD 2].log
-Ninetet (Yoshi's) 1997, Vol. 1 [CD 2].cue

I can achieve this in AdvancedRenamer by using "DirName:1" for .cue files and "DirName:2 - DirName:1" for .log files.
But I'd much prefer to be able to do this with PowerRename.

@xanderificnl
Copy link

xanderificnl commented May 10, 2023

Another example:

subs/a/1_english.srt  -> subs/a.srt
subs/b/5_english.srt  -> subs/b.srt
subs/c/3_english.srt  -> subs/c.srt

Allowing us to capture and match on the entire path that's been opened (i.e. subs/) would be wonderful, i.e.:

subs\\(.*)\\.*English\.srt -> $1.srt

FWIW, with mmv on Linux, this would work:

mmv '*/*_English.srt' '#1.srt'

@EStegenburgs
Copy link

Also, useful on measurement generated files that, as others have pointed out, in general, might be saved with non-unique filenames but folder names or their overall path define the properties or attributes, which for various reasons you might want or need to include in the filenames, and then one can (optionally) move all files to a single directory.

@cow1337killer3
Copy link

cow1337killer3 commented Oct 7, 2023

Can we please get this? Was surprised it wasn't already a feature.

How about this: $p3 expands to the 3rd directory above the item, etc.

Current item: 'C:\Users\Bob\Downloads\Cool Band\New album\Track 1.mp3'
$p expands to 'Track 1.mp3' (with extension)
$p0 expands to '.mp3' (only extension)
$p1 expands to 'Track 1' (without extension)
$p2 expands to 'New album'
$p3 expands to 'Cool Band'

And it completely avoids the problem of them attempting to include path separators in the new name.

So, renaming from
'.*'
to
'$p3 - $p1 ($p2).$p0'
would give
'Cool Band - Track 1 (New album).mp3'

@06000208
Copy link

06000208 commented Oct 29, 2023

what is the scenario for which this feature is a requirement, instead of just going to the parent folder and start PowerRename from there?

You could have many parent folders on the same level, with information you'd rather be in their files' names.

Without it, the alternative is manually repeating the same process, with that information put into PowerRename per folder, on N amount of folders. Could be two, could be five, could be fifty. Wasted time, you know?

For anyone with a similar need for this feature before it's implemented, Advanced Renamer has it.

@azcom
Copy link

azcom commented Mar 15, 2024

Over 3 years and still not implemented?

This seems like such a basic string to include too so I'm shocked that it's still not been added.

It would be infinitely useful and from the numerous duplicate requests that have been closed in favour of this one it shows that many other people have a need for this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idea-Enhancement New feature or request on an existing product Product-PowerRename Refers to the PowerRename PowerToy
Projects
None yet
Development

No branches or pull requests

10 participants