Page 1 of 1

Renaming a specific file type by the folder name

PostPosted: Sun Jun 02, 2019 10:03 am
by mitviz
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

Re: Renaming a specific file type by the folder name

PostPosted: Mon Jun 03, 2019 11:56 am
by therube
So if this does what you need.


2:Name -> Remove

12:Filters -> *.png

9:Append Folder Name - Name:Prefix

Re: Renaming a specific file type by the folder name

PostPosted: Mon Jun 03, 2019 4:04 pm
by mitviz
yes sire this does exactly what i needed, big thank you!

Re: Renaming a specific file type by the folder name

PostPosted: Tue Jun 04, 2019 2:22 am
by mitviz
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

Re: Renaming a specific file type by the folder name

PostPosted: Thu Jun 06, 2019 11:07 pm
by mitviz
Any help guys? @therube

Re: Renaming a specific file type by the folder name

PostPosted: Sun Jun 09, 2019 2:11 pm
by therube
There is another case

Clearer description/example ?

Re: Renaming a specific file type by the folder name

PostPosted: Sun Jun 09, 2019 11:45 pm
by mitviz
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

Re: Renaming a specific file type by the folder name

PostPosted: Mon Jun 10, 2019 12:22 pm
by therube

Re: Renaming a specific file type by the folder name

PostPosted: Mon Jun 10, 2019 4:28 pm
by mitviz
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

Re: Renaming a specific file type by the folder name

PostPosted: Mon Jun 10, 2019 4:32 pm
by mitviz
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

Re: Renaming a specific file type by the folder name

PostPosted: Thu Jun 13, 2019 5:11 pm
by therube
(I'm not able to see the above. Hopefully this will work:)
Image

Re: Renaming a specific file type by the folder name

PostPosted: Thu Jun 13, 2019 5:23 pm
by therube
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.

Re: Renaming a specific file type by the folder name

PostPosted: Thu Jun 13, 2019 5:42 pm
by mitviz
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?