by truth » Sat Apr 26, 2014 12:00 pm
Im afraid I mis-understand the scenario.
There should be no reason to SubDir-separate SameName.eps from SameName.jpg?
Unless perhaps using an app that disregards file-extensions (or has other special requirements)?
If so, I'd unpack into 1Folder & then BRU-rename as: Same.Name.eps -> Same.Name-eps.eps
1Regex settings:
(.*)(\..*)
\1-\2
IncludeExt=Checked
That would eliminate the need to: CreateSubDir / RenameBySubDir / MoveUp1Dir
Throw in 12Filters like *.jpg *.eps to only affect those filetypes if needed.
Just edit the replace if you have a name-format that must be adhered to.
-----------------------------------------------------------------------------------------------------------------
If you meant that EPS/JPG are SubDirNames within .zip? I'd unpack to those default folders,
then rename similiarly, but only to ensure unique filenames before moving them up 1-directory.
Here's some example batch-lines that could prove helpful, depending on your scenario:
FOR /f "delims=" %%d IN ('dir /ad/b') DO for /f "delims=" %%f in ('dir /b/a-d "%%d\*.*"') do IF not exist "C:\DirPath\ParentDir\%%f" move "%%d\%%f" .
FOR /f "delims=" %%b in ('dir /b/ad') do brc32 /Dir:"C:\DirPath\ParentDir\%%b" /nofolders /ignorefilex /regexp:(.*)\.(.*):\1-\2.\2 /execute
FOR /f "delims=" %%d IN ('dir /ad/b') DO for /f "delims=" %%f in ('dir /b/a-d "%%d\*.*"') do IF not exist "C:\DirPath\ParentDir\%%f" move "%%d\%%f" .
FOR /f "delims=" %%k in ('dir /b/ad/s') do RD "%%k"
Line1 moves all files 1-SubDir below ParentDir into ParentDir (unless pre-existing names already exist there)
Line2 renames left-behind-files that couldnt be moved (as: filename-ext.ext)
Line3 moves those renamed files into ParentDir
Line4 then deletes all empty directories
While C:\DirPath\ParentDir\ is hard-coded into 3 batchlines, it's obviously not preferrable.
Omitting it (leaving all "" intact) lets you to run the batch against any ParentDir by typing:
BatchName.bat "C:\DirPath\YourParentDir" from the prompt, etc.
I included DirPaths as a precaution, since anyone could copy/paste this into a batch, & then just click it!
It'd be deadly without DirPaths (unless placed in the right ParDir & they were happy with the rename-structure)
I have a similiar batch that 1st displays CurDir & intentions, then prompts for user-input before executing.
I usually let sed create such commands, but it dawned on me that a nested FOR statement might work.
I know we're not supposed to, but it worked fine on my system, your mileage may vary, might be worth testing.
Just throwing out different ideas/approaches, since BRU doesnt offer selective SubDir depth-levels.
Hopefully some of this will prove helpful, though I misunderstand the DirStructure/names within .zips
Good luck, & post back if you wish to pursue any further.