Append name with dissimilar folder tree

A swapping-ground for Regular Expression syntax

Append name with dissimilar folder tree

Postby Fastscirocco » Fri Jun 29, 2018 3:13 pm

This is a great tool and I'm glad I found it, I have a task to accomplish requiring the renaming of files.
What I am hoping to do is renaming the files based on the names of the folders going up the folder tree stopping at the parent folder.
My challenge is that each folder tree is not the same length. I have placed the files and folders in a folder named test.

Example

Test\client-one\alpha-folder\meeting-date-1-data\report.pdf
Test\client-one\alpha-folder\meeting-date-2-data\report.pdf
Test\client-one\bravo-folder\notes.pdf
Test\client-one\charlie-folder\product\application\documentation\results.pdf

In each of the folders there are files with names that were non- client specific and repeatedly used. I need to move all of the files to one
spot and have to rename the files so I know what they are and which client they go with. I am hoping to append the names of all of the folders
in the tree above the file up to but not including the folder named test.

In the top example "report.pdf" would be renamed "client-one-alpha-folder-meeting-date-1-data-report.pdf"

Is this something the bulk rename utility can accomplish? So far it appears it can append folder names to files but you have to tell it how far up the tree to go, and that is
where I have problems because the tree length isn't consistent.

Thanks
Chris
Fastscirocco
 
Posts: 1
Joined: Fri Jun 29, 2018 2:56 pm

Re: Append name with dissimilar folder tree

Postby therube » Fri Jan 25, 2019 6:21 pm

(Old thread, but I've had it open in my browser history, so...)

but you have to tell it how far up the tree to go, and that is
where I have problems because the tree length isn't consistent


Appears that doesn't particularly matter.
Don't know how many 'Level's is accepted, but try, 99.

9:Append Folder Name
Code: Select all
Name:  Prefix
Sep:  -
Levels:  99


With that, so long as Levels is "high enough", you can always adjust things after the fact.

So:
Code: Select all
Test\client-one\alpha-folder\meeting-date-1-data\report.pdf

Becomes
Code: Select all
Test\client-one\alpha-folder\meeting-date-1-data\Test-client-one-alpha-folder-meeting-date-1-data-report.pdf


After that, move the files into the directory you want, say a 'Clients' directory.
And if you don't want the 'Test-' part, then rename the files again, removing that part.

Code: Select all
Clients\client-one-alpha-folder-meeting-date-1-data-report.pdf
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm


Return to Regular Expressions