Same file names in different sub-folders

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

Same file names in different sub-folders

Postby LordDan » Sun Oct 20, 2013 6:57 pm

Good morning,

I'm trying to find a way to copy/move files in multiple subfolders that have the same name (the files) to a single directory.

For example:

c:\test\folder1\test1.txt
c:\test\folder1\test2.txt
c:\test\folder1\test3.txt

c:\test\folder2\test1.txt
c:\test\folder2\test2.txt
c:\test\folder2\test3.txt

c:\test\folder3\test1.txt
c:\test\folder3\test2.txt
c:\test\folder3\test3.txt

etc...

all copied/moved to a single directory like this: (or anything close to this will work - just need all the files in a single directory with duplicates copied/moved too (that's been the hurdle I can't figure out).

c:\test\combined\test1.txt
c:\test\combined\test1(1).txt
c:\test\combined\test1(2).txt
c:\test\combined\test2.txt
c:\test\combined\test2(1).txt
c:\test\combined\test2(2).txt
c:\test\combined\test3.txt
c:\test\combined\test3(1).txt
c:\test\combined\test3(2).txt

Any thoughts how I could do this?

Suggestions are greatly appreciated!

Daniel
LordDan
 
Posts: 2
Joined: Sun Oct 20, 2013 6:40 pm

No DirName filtering

Postby truth » Mon Oct 21, 2013 3:58 am

BRC is a file renamer, not a copier or mover.

/Recursive is the only option to access multiple Dir's, no Dir-filtering is avail
Multiple /Dir: commands on the same commandline(after the 1st one) are disregarded
/Pattern: only matches filenames

Depending on how you need to match certain SubDirNames, I'd prob write a .bat for this
If the DirName matching was complex enough, I'd use sed to create these .bats on the fly

The BRU graphical version has a move/copy option, but this example requires:
12Files=Checked
12SubFolders=Checked
13Path=c:\test\combined
13CopyNotMove=Checked
Options PreventDuplicates=Checked

LeftPane Select C:\Test
RightPane SortBy SubDirColumn (to ensure proper CopyAppendage#)
Manually select filenames, then click rename
(CopyAppendage# may not exceed 99)
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay

Re: Same file names in different sub-folders

Postby LordDan » Mon Oct 21, 2013 9:40 pm

Thanks Truth,

I knew it was only a renamer - but if it could get it to rename the files (all to something different from each other), I could then add a batch file to copy/move them.

Fortunately, I DID find a way to make it work almost how I wanted it to. It's close enough that it'll work.

Thank you very much for the quick response though - have a fantastic week!

Regards,

Daniel
LordDan
 
Posts: 2
Joined: Sun Oct 20, 2013 6:40 pm

Re: Same file names in different sub-folders

Postby truth » Tue Oct 22, 2013 3:38 pm

No worries,
Sorry, I'd assumed the file-renaming would be easy? I'm prob missing something?
I'm definitely unclear as to whether DirName filtering is needed to limit SubDirs.
What's your file-match criteria, other than IfAnotherSameFileNameExists?
The main point though, was that BRC will never move/copy files (or filter by SubDir)

Batches are entirely different, they can execute alot more commands than 1 BRC-line at the prompt.
I'd prefer sed, as it could 1st match IfAnyOtherSameFileNameExists, & then create the proper batch-commands.
Post back if you want to get exact via batch, otherwise glad you found something close enough.
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay


Return to BRC Support