Page 1 of 1

Rename files based on folder name possible?

PostPosted: Tue Mar 31, 2009 7:41 am
by V for Vendetta
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

Re: Rename files based on folder name possible?

PostPosted: Tue Mar 31, 2009 11:51 am
by GMA
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.

Re: Rename files based on folder name possible?

PostPosted: Tue Mar 31, 2009 8:26 pm
by V for Vendetta
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

Re: Rename files based on folder name possible?

PostPosted: Wed Apr 01, 2009 4:30 am
by GMA
Glad it was of help :wink:

Re: Rename files based on folder name possible?

PostPosted: Tue Oct 19, 2010 8:51 pm
by stonersports
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

Re: Rename files based on folder name possible?

PostPosted: Wed Oct 20, 2010 7:13 am
by Stefan
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

Re: Rename files based on folder name possible?

PostPosted: Mon Nov 15, 2010 4:33 pm
by thirteen
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.

Re: Rename files based on folder name possible?

PostPosted: Wed Nov 17, 2010 12:00 pm
by Admin
Yes, use Remove (5) to remove the original file name, Numbering (10) for the counter and Append Folder Name (9) for the folder.

Re: Rename files based on folder name possible?

PostPosted: Thu Nov 18, 2010 8:28 am
by thirteen
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. ?

Re: Rename files based on folder name possible?

PostPosted: Thu Nov 18, 2010 3:21 pm
by Admin
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

Re: Rename files based on folder name possible?

PostPosted: Fri Jun 15, 2012 3:33 pm
by Snake
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

Re: Rename files based on folder name possible?

PostPosted: Fri Jun 15, 2012 3:42 pm
by Snake
I have of course numbers active and incr. of 1 which usually changes the number but this time it doesn't work...

(Solved) Rename files based on folder name possible?

PostPosted: Fri Jun 22, 2012 9:50 pm
by Zodiac69
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

Re: Rename files based on folder name possible?

PostPosted: Wed Aug 21, 2019 5:42 am
by Wryson
--------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?