Appending folder names?

Bulk Rename Utility How-To's

Appending folder names?

Postby dvejr » Mon Sep 02, 2024 7:40 am

My current folder and file structure is:

English\Author\Title\

There are many authors. All have at least one title. Most authors have more than one title.

In each title subfolder there are up to 4 files with the same name but different extensions:

English\Author\Title\project.doc
English\Author\Title\project.txt
English\Author\Title\project.pdf
English\Author\Title\project.mp4

My goal is to rename (and then move) the txt files and ignore the other files.
For the txt files, the desired new filename would eliminate the word "project", and incorporate the appended higher-level foldernames like this:
Title Author.txt

I see how to Remove (5) the word "project" by setting "Last n" to 7

I see how to Append Folder Name (9), but only in parent, then child order, when I increase the level from 1 to 2. So it will give me
Author Title.txt

Is there a way to get Title Author.txt?

Thanks in advance for any help.
dvejr
 
Posts: 2
Joined: Mon Sep 02, 2024 6:54 am

Re: Appending folder names?

Postby dvejr » Tue Sep 03, 2024 4:51 am

I'm new at this board, not sure how to edit something I posted.

I think the key to resolving my problem is to rename my file once (prepending the folder name), COPY it to its parent directory, then rename it again there, appending the new, higher, folder name.

The Copy/Move to Location (13) function allows me to put renamed files in one specific directory, but I want each renamed file to move or be copied to it's own next-higher folder. Can function 13 deal with relative destinations?

Doug
dvejr
 
Posts: 2
Joined: Mon Sep 02, 2024 6:54 am

Re: Appending folder names?

Postby Admin » Fri Sep 13, 2024 11:25 pm

Hi! yes, it's possible with Javascript but you would need a commercial license for BRU as Javascript is only available with a license.
Admin
Site Admin
 
Posts: 2504
Joined: Tue Mar 08, 2005 8:39 pm

Re: Appending folder names?

Postby Admin » Fri Sep 13, 2024 11:29 pm

The function is :

Code: Select all
newName = object("container[1]") + " " + object("container[2]");
Admin
Site Admin
 
Posts: 2504
Joined: Tue Mar 08, 2005 8:39 pm


Return to How-To