Bulk Rename Files to Parent Folder Name

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

Bulk Rename Files to Parent Folder Name

Postby groundswell » Thu May 21, 2020 5:35 pm

Hi,

i have been using the gui version of bulk rename for awhile to achieve this but I am having instances where I have sometimes dozens of individual folders that I need to rename files inside them and trying to reduce the amount of clicking it requires.

Currently I have individual folders that have 1 file in each of these folders that I would like to rename as the folder name. I would appreciate any help in creating script for use with command line version. I have a screenshot below showing what I am currently doing with the gui version of bulk rename now for reference.

Image

Thanks!
groundswell
 
Posts: 6
Joined: Thu May 21, 2020 5:24 pm

Re: Bulk Rename Files to Parent Folder Name

Postby therube » Fri May 22, 2020 12:11 pm

As a start, mess around with this & see where it gets you.
(In this case, perhaps in general, command line ordering is important; i.e., the /REMOVENAME switch needs to come before [at least some of] the others...)

Code: Select all
brc32.exe  /removename  /appendfolder:P:___:1  /pattern:*.TXT  /recursive


(I stuck the underlines in there only to make changes more apparent.)
therube
 
Posts: 1367
Joined: Mon Jan 18, 2016 6:23 pm

Re: Bulk Rename Files to Parent Folder Name

Postby groundswell » Sat May 23, 2020 5:19 am

Thanks for the sample code!

I ran the following command:
C:\BRC\BRC64.exe /removename /appendfolder:P::1 /pattern:*.TXT /recursive

Unfortunately it didn't rename any of the files. Below are screenshots of the results.

Image
Image
groundswell
 
Posts: 6
Joined: Thu May 21, 2020 5:24 pm

Re: Bulk Rename Files to Parent Folder Name

Postby RegexNinja » Sat May 23, 2020 7:59 am

Please note that /Pattern is case-sensitive, so you might need something like:
C:\BRC\BRC64 /Pattern:"*.txt *.TXT" /Recursive /RemoveName /NoDup /AppendFolder:P::1

That renames files like: ParentFolder, but if any folder has more than 1-file:
It starts renaming like: ParentFolder_1, ParentFolder_2, etc (they dont show that way in the preview).
Cheers.
RegexNinja
 
Posts: 134
Joined: Fri Feb 21, 2020 5:26 pm

Re: Bulk Rename Files to Parent Folder Name

Postby groundswell » Sat May 23, 2020 11:57 pm

It looks like that command will work to rename the files but it didn't actually rename the files, they still kept the original file name. Below is a screenshot of what I ran and results.

Image


Thanks!
groundswell
 
Posts: 6
Joined: Thu May 21, 2020 5:24 pm

Re: Bulk Rename Files to Parent Folder Name

Postby RegexNinja » Sun May 24, 2020 12:08 am

Once you're happy with the preview, and you're not worried about more than one file per SubFolder.
Just add /Execute to the end of your command-line, that will actually perform the renames.
Cheers!
RegexNinja
 
Posts: 134
Joined: Fri Feb 21, 2020 5:26 pm

Re: Bulk Rename Files to Parent Folder Name

Postby groundswell » Sun May 24, 2020 12:15 am

Thanks for that! Tested with the execute switch and all good now. Considered this resolved!

Thanks everyone for the help! :D
groundswell
 
Posts: 6
Joined: Thu May 21, 2020 5:24 pm

Re: Bulk Rename Files to Parent Folder Name

Postby trm2 » Sun May 24, 2020 4:00 am

How do you get the screenshots in the forum?
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm

Re: Bulk Rename Files to Parent Folder Name

Postby groundswell » Sun May 24, 2020 4:26 am

You can click the Img button when you are replying.
Image

Then you need to have the image online somewhere so you can add the URL for it between the [img} tags. I use imgur but probably any online image host will work.
Image
groundswell
 
Posts: 6
Joined: Thu May 21, 2020 5:24 pm

Re: Bulk Rename Files to Parent Folder Name

Postby trm2 » Sun May 24, 2020 4:43 am

Thanks. I'll keep that in mind but I usually do not use any kind of cloud (old fashioned).

I appreciate the quick response.
trm2
 
Posts: 156
Joined: Wed Jan 15, 2020 12:47 pm


Return to BRC Support


cron