Rename files based on folder name possible?

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

Rename files based on folder name possible?

Postby V for Vendetta » Tue Mar 31, 2009 7:41 am

Firstly, I want to acknowledge that this a GREAT utility, with more features than any other of it's kind. Congratulations Jim!

Now on to my question:

I use BRU to often rename folders into an orderly fashion - for example, on drive E:\ I'll have a main folder called Vacations

As subfolders I'll have folders named:

Vacation.1980
Vacation.1981
Vacation.1982
Vacation.1983
Vacation.1984


etc. up through the present year.

As you might imagine, I simply dump pictures from those years into their respective yearly subfolder.

So, while on the left-pane, if I highlight the main folder (E:\Vacations), the right-pane shows all the "yearly folders."

What I can't seem to find out how to do - hence it may not be possible with BRU - what I want to be able to do is auto-rename files in a folder based on the folder name. My intention was/is to use the

foldername to use as the filename, and then use suffixes and numbering to give the new filenames meaningful names.

For example, using BRU, I'd like for all the files, regardless of their current filename, to automatically be renamed based on my specifications.

So, for example, in the Vacation.1983 folder, BRU would auto-rename all the files in that folder to

Vacation.1983.001.jpg
Vacation.1983.002.jpg
Vacation.1983.003.jpg
Vacation.1983.004.jpg


etc.

Does BRU have this capability? If not, I think it would be a great additional feature, as I have occasion to this type of renaming quite often - only now, I have select each subfolder manually and manually use the RegEx(1) replace function go from there.

Thanks for your consideration...

V
V for Vendetta
 
Posts: 2
Joined: Tue Mar 31, 2009 7:09 am

Re: Rename files based on folder name possible?

Postby GMA » Tue Mar 31, 2009 11:51 am

Hi, V:
Sure, follow these steps:

1. On the left pane (the folder tree) select "E:\Vacations".
2. In Selections (12) check only "Files" and "Subfolders".
3. Set Numbering (10) as "Mode = Suffix", "Pad = 3", "Sep. = ." and check the "Folder" option.
4. In File (2) select "Remove".
5. In Append Folder Name (9) select "Prefix".
6. Make sure you have your files selected (press CTRL+A or use the "Actions > Select All" menu.)
7. Now you can preview the results on the right pane, and, if everything's ok, just press "Rename".

Cheers,

Gabriel.
Last edited by GMA on Wed Apr 01, 2009 4:30 am, edited 1 time in total.
GMA
 
Posts: 91
Joined: Sun Dec 02, 2007 1:30 pm
Location: Argentina

Re: Rename files based on folder name possible?

Postby V for Vendetta » Tue Mar 31, 2009 8:26 pm

Thank you 1x10^9!!! Did exactly what I wanted. Will save me hours of work.

I did read the PDF manual and help file, but the parts I never would've figued out would have been your Step 4, end especially your Step 5 Append Folder Name (9)

I've never needed to use File (2) select "Remove" in anything I've had to rename before, and Append Folder Name (9) I always assumed only applied for Folder renaming. Obviously not!

Thanks for the quick and perfect solution!

V

Image
V for Vendetta
 
Posts: 2
Joined: Tue Mar 31, 2009 7:09 am

Re: Rename files based on folder name possible?

Postby GMA » Wed Apr 01, 2009 4:30 am

Glad it was of help :wink:
GMA
 
Posts: 91
Joined: Sun Dec 02, 2007 1:30 pm
Location: Argentina

Re: Rename files based on folder name possible?

Postby stonersports » Tue Oct 19, 2010 8:51 pm

I gotta say - this is absolutely an AMAZING utility!! I've downloaded quite a number of these, and this one easily tops them all!! It will save me a TON of time!

I have one other question in regards to naming files within directories, based on the directory names:

I have a folder named "AckleyDustin", with no space in the name, but the caps showing me the seperation. The files will currently be renamed to

AckleyDustin 001(Stoner).jpg

...which works just fine...but I'd LIKE to be able to rename them to

Ackley Dustin 001(Stoner).jpg

Is there a way to do this, based on the ONE capital letter seperating the two names within the directory title? Keep in mind that each name is different, for the hundreds of people that go into folders each year...

Thanks for any help!
David
stonersports
 
Posts: 2
Joined: Tue Oct 19, 2010 8:44 pm

Re: Rename files based on folder name possible?

Postby Stefan » Wed Oct 20, 2010 7:13 am

Hi David,

you want to rename files with parent folder name? Then this thread would be good to post in.
But your question is an other issue: "Split strings at upper case char" and so this is worth to open an new threat for this new question!

FROM:
AckleyDustin 001(Stoner).jpg
TO:
Ackley Dustin 001(Stoner).jpg
TRY if this works for you:

RegEx(1):
Match: (.+?)([A-Z])(.+)
Repla: \1 \2\3

Explanation:
Match one-or-more of any sign, non-greedy ==> (.+?) ====> Ackley ====> stored in group 1
Only till an upper case char out of A,B,C,...Z ==> ([A-Z]) ====> D ====> stored in group 2
Match the rest of the string ==> (.+) ====> ustin 001(Stoner).jpg ====> stored in group 3

Then replace with group \1, an space, group \2 and \3 ==> \1 \2\3


I guess there is already an thread about this issue,... but i can't find it right now.
It could be that this regex didn't work in all cases, depending on your real names.
This solution splits only at one upper char, so it's not good for StringsWithMoreThenOneUpperChars.
Copy your files first and test with this copies to be secure.



stonersports wrote:I gotta say - this is absolutely an AMAZING utility!! I've downloaded quite a number of these,
and this one easily tops them all!! It will save me a TON of time!

I have one other question in regards to naming files within directories, based on the directory names:

I have a folder named "AckleyDustin", with no space in the name, but the caps showing me the seperation.

The files will currently be renamed to

AckleyDustin 001(Stoner).jpg

...which works just fine...but I'd LIKE to be able to rename them to

Ackley Dustin 001(Stoner).jpg

Is there a way to do this, based on the ONE capital letter seperating the two names within the directory title?
Keep in mind that each name is different, for the hundreds of people that go into folders each year...

Thanks for any help!
David
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Rename files based on folder name possible?

Postby thirteen » Mon Nov 15, 2010 4:33 pm

Hi ,
I downloaded this utility today and it has been of great use . Its an absolutely brilliant piece of software. :)

I have a huge movie collection and i have all the movies organized as language->moviename_folder->video files

like i have a folder called "English", inside which are a lot of folders named like "serendipity", "terminator" etc. and the corresponding video files are inside those respective folders.
Here is what i wish to do . I want to rename these video files in all these folders to their folder name. If there is more than one file, then i want to append numbers to distinguish each file.

Eg. if "terminator" has files named term1.avi, termb.avi .. i want them renamed to "terminator 1.avi", "terminator 2.avi" etc.. and i want to do this for all the folders in the main folder , i.e "English" at one go .

Is this possible ? I sure hope it is :) .

Thanks in advance.
thirteen
 
Posts: 2
Joined: Mon Nov 15, 2010 4:19 pm
Location: India

Re: Rename files based on folder name possible?

Postby Admin » Wed Nov 17, 2010 12:00 pm

Yes, use Remove (5) to remove the original file name, Numbering (10) for the counter and Append Folder Name (9) for the folder.
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Rename files based on folder name possible?

Postby thirteen » Thu Nov 18, 2010 8:28 am

but i will have to do this for each folder inside the main one right ?
is there any way i can do this for all folders at one go. ?
thirteen
 
Posts: 2
Joined: Mon Nov 15, 2010 4:19 pm
Location: India

Re: Rename files based on folder name possible?

Postby Admin » Thu Nov 18, 2010 3:21 pm

If you enable subfolders in Selection (12) , BRU will process all files in subfolders too, but before you do that make sure the files are renamed as you wish, using the BRU preview feature. thanks
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Rename files based on folder name possible?

Postby Snake » Fri Jun 15, 2012 3:33 pm

I have 200 folders containing the same twelve pictures. Each foldername should be 6216XXX (6216001, 6216002,....,6216200). Then I want each one of these pictures to be named the folders name followed by a "-" and a number (6216001-1, 6216001-2,..., 6216001-12).

I however come to the problem that ALL of my pictures are named correct until the last number where they ALL end with "-5" (twelve pictures all named 6216001-5, twelve pictures all named 6216002-5 etc) (why i therefore of course recieve a failure message).

Very confused! How should I do? Printscreen at the link (might show "-1", but the problem remains since they ALL are named "-1").

https://www.dropbox.com/home#!/lightbox/home/Public
Last edited by Snake on Fri Jun 15, 2012 3:44 pm, edited 1 time in total.
Snake
 
Posts: 2
Joined: Fri Jun 15, 2012 2:56 pm

Re: Rename files based on folder name possible?

Postby Snake » Fri Jun 15, 2012 3:42 pm

I have of course numbers active and incr. of 1 which usually changes the number but this time it doesn't work...
Snake
 
Posts: 2
Joined: Fri Jun 15, 2012 2:56 pm

(Solved) Rename files based on folder name possible?

Postby Zodiac69 » Fri Jun 22, 2012 9:50 pm

Solved - re-looked at the reply post, i did not select the files after my setup :oops:

All good
Hi all

I have a similar requirement as V for Vendetta but...
All my folders have the correct names, the files in the folders are not correctly named.

My folder structure is as follow:
Main
-----Sub1
----------file1.x
----------file2.y
----------file3.z
-----Sub2
----------file4.x
----------file5.y
-----Sub3

I think you get the picture, i need to rename the files in each "Sub" to match the "Sub" name
Have any of you done this and can you please point me in the direction of how this is done?

Z69
Zodiac69
 
Posts: 1
Joined: Fri Jun 22, 2012 9:41 pm

Re: Rename files based on folder name possible?

Postby Wryson » Wed Aug 21, 2019 5:42 am

--------THREAD RESURRECTION-------

I know I'm resurrecting this post, but it seems to be about as close to on target as I'm lookin' for.

In the same vein as the OP from years ago, I have a bunch of files inside a folder, and in those files names is the name of the folder it's in. Is it possible to have BRU *REMOVE* that from it?

Example:

Folder is GREEN

File is named GREEN-MULCH.txt

I want to remove GREEN From it, and any other files inside the folder that also have "GREEN" in it. Is this possible?
Wryson
 
Posts: 4
Joined: Tue Aug 20, 2019 10:44 pm


Return to BRU Support