Renaming a specific file type by the folder name

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Renaming a specific file type by the folder name

Postby mitviz » Sun Jun 02, 2019 10:03 am

Hi, i have a bunch of folders with a few filetypes inside, i would like to know if it is possible to select all those folders and have a specific file inside each of those folders renamed to have the same name of the folder, for example i have a folder with jpegs and one png inside and i want to rename the png file inside to the name of the folder, usually its only one of that file type inside the folder i want to rename but idk if its possible
mitviz
 
Posts: 8
Joined: Sun Jun 02, 2019 10:00 am

Re: Renaming a specific file type by the folder name

Postby therube » Mon Jun 03, 2019 11:56 am

So if this does what you need.


2:Name -> Remove

12:Filters -> *.png

9:Append Folder Name - Name:Prefix
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Renaming a specific file type by the folder name

Postby mitviz » Mon Jun 03, 2019 4:04 pm

yes sire this does exactly what i needed, big thank you!
mitviz
 
Posts: 8
Joined: Sun Jun 02, 2019 10:00 am

Re: Renaming a specific file type by the folder name

Postby mitviz » Tue Jun 04, 2019 2:22 am

There is another cases where if the file i am trying to rename is a level or two deep in a subfolder it will not get renamed to the main folder name but the subfolder name, any workaround to this? thanks
mitviz
 
Posts: 8
Joined: Sun Jun 02, 2019 10:00 am

Re: Renaming a specific file type by the folder name

Postby mitviz » Thu Jun 06, 2019 11:07 pm

Any help guys? @therube
mitviz
 
Posts: 8
Joined: Sun Jun 02, 2019 10:00 am

Re: Renaming a specific file type by the folder name

Postby therube » Sun Jun 09, 2019 2:11 pm

There is another case

Clearer description/example ?
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Renaming a specific file type by the folder name

Postby mitviz » Sun Jun 09, 2019 11:45 pm

for example i have a folder "A" and inside that folder are two level deep subfolders, so first layer subfolder "B" would have another folder in it "C", so inside A is b and inside b is c and inside subfolder c is the file i want to rename and have the same name as the main folder "A", is it possible? so far with the method you gave me first it does what i want but that is only when the file is only in folder "A", if the file is in subfolder "C" it takes the name of that subfolder
mitviz
 
Posts: 8
Joined: Sun Jun 02, 2019 10:00 am

Re: Renaming a specific file type by the folder name

Postby therube » Mon Jun 10, 2019 12:22 pm

therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Renaming a specific file type by the folder name

Postby mitviz » Mon Jun 10, 2019 4:28 pm

ok i got it to work but the only issue is it is keeping the original filename at the end, i was the entire filename to be the name of the folder up and remove the old file name entirely
mitviz
 
Posts: 8
Joined: Sun Jun 02, 2019 10:00 am

Re: Renaming a specific file type by the folder name

Postby mitviz » Mon Jun 10, 2019 4:32 pm

Image

so in this case you can see 1 is the main folder but the file is in folder 2 but when i rename it is keeping the original name at the end
mitviz
 
Posts: 8
Joined: Sun Jun 02, 2019 10:00 am

Re: Renaming a specific file type by the folder name

Postby therube » Thu Jun 13, 2019 5:11 pm

(I'm not able to see the above. Hopefully this will work:)
Image
Last edited by therube on Thu Jun 13, 2019 5:25 pm, edited 1 time in total.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Renaming a specific file type by the folder name

Postby therube » Thu Jun 13, 2019 5:23 pm

See what Ken wrote, viewtopic.php?p=8567#p8567.

By adding a separator, that will give you something to go back to use as a filter to then remove the unwanted part.

As it is you can't say "2 directories up - nothing intervening".
What you get is, parent.dir+parent.dir.

So you end up with a name (abbreviated) like:
127928fytomod

If you add a separator (depending on what you choose as the separator) you can have something like:
127928_fytomod

With that, you can then come back & say:
1:RegEx
Code: Select all
Match: (.*?)_(.*)
Replace: \1

Then you're left with only the 127928 part.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Renaming a specific file type by the folder name

Postby mitviz » Thu Jun 13, 2019 5:42 pm

i actually have no clue how you use that part, i checked regEx checkbox but where so i input that last bit after i copy it here?
mitviz
 
Posts: 8
Joined: Sun Jun 02, 2019 10:00 am


Return to BRU Support


cron