[Originally posted by bv on 2007-12-18 04:31:00-08]Below are two DOS Batch_Windows Command files that perform the following:
1 The main file, Reset_Original.cmd, Iterates through a directory of *.jpg and *.cr2 files
2 When it finds one it calls Reset_Orig-1.cmd passing the filename as a argument
3 Reset_Orig-1.cmd batch file checks for both the short name and the longer name _original file and if they both exist, it deletes the short name file and renames the longer name _original file to the short name file.
Enjoy... Brooks
@echo off
Rem Reset_Original.cmd
Rem Deletes the modified file if a corresponding _original file
Rem exists and then renames the originial back
for %%i in (*.jpg *.cr2) do call Reset_Orig-1.cmd %%i
:Exit
Rem End of Reset_Original.cmd
@echo off
Rem Reset_Orig-1.cmd
Rem Called Reset_Originals.cmd which passes the filename to this batch file
Rem This checks for a corresponding _original file and if both exists, then
Rem it deletes the short file and renames the originial back to the short filename
echo *** Procesing:
dir /b %1*
IF EXIST %1_original goto fix
echo Ignoring: %1
goto exit
:fix
echo Deleting: %1
del %1
echo Renaming: %1_original to %1
rename %1_original %1
:exit
Rem End of Reset_Orig-1.cmd
Brooks