|
Answer» I'm really pulling my hair out on this one. I collect PICTURES of motorcycles, hot rod cars (especially Mustangs), and racing boats. I use bulk file renamer to place them in the following format:
KawasakiNinja300-001-001.jpg KawasakiNinja300-001-002.jpg KawasakiNinja300-001-003.jpg KawasakiNinja300-002-001.jpg KawasakiNinja300-002-002.jpg KawasakiNinja300-002-003.jpg KawasakiNinja300-161-150.jpg
Sometimes the second part of the file name will not contain 3 NUMBERS but sometimes 2,1, or even 4. For example:
1990BlackMustangGT-01-01.jpg
LamborghiniCountach-1-01.jpg
And the list goes on with thousands of files in their respective directories. The first part of the filename is the make and model of the vehicle. I use a hyphen as a separator to denote the numbered series that it belongs to and another hyphen to denote the INDIVIDUAL picture within the series. So essentially the filename is broken down into three parts using a hyphen as a separator.
I'm looking for a batch file that will move each file into a directory named after the numbers after the first hyphen and before the second hyphen (the second part of the filename).
Thank you so much.
Jason
Try this on a sample of your files - not the real set. It's UNTESTED. Run it from the root folder of your collection after testing.
If it works ok - remember not to run it twice on the same set of folders or it will create an extra level deep of folders.
Where it will have an issue is if any of the descriptive parts of the filename has a - in it. Say Kawasaki-Jawa-001-002.jpg
Code: [SELECT]@echo off for /f "delims=" %%z in ('dir /ad /b /s') do ( pushd "%%z" for %%a in (*.jpg) do ( for /f "tokens=2 delims=-" %%b in ("%%a") do ( md "%%b" 2>nul move "%%a" "%%b" >nul ) ) popd ) pause
|