DeleteFiles
DeleteFiles copied to clipboard
"Simple File Specs"?
When indicating that you can delete files with "simple file specs", I was under the impression that the spec was simple.
I tried to delete all images that end with "*temp.jpg" and it didn't work. Am I 1) doing something wrong or is this a 2) bug or shortcoming of this script? If 2, is there a recommended workaround?
Here's a potential workaround that involves temporarily & recursively renaming all *temp.jpg files to *temp.tmp, deleting old .tmp files and then restoring the original file extension.
REM Delete TEMP JPG files older than 5 days
REM Rename all JPGs ending with "temp.jpg" to "temp.tmp"
SET startdir="c:\DirectoryWithImages"
for /r %startdir% %%i in (*temp.jpg) do ren "%%i" "%%~ni.tmp"
REM Delete TMP files older than 5 days
cd c:\DeleteFiles\
c:\DeleteFiles\DeleteFiles.exe ""c:\DirectoryWithImages\*.tmp"" -r -d5 -q1
REM Rename TMP files back to JPG
for /r %startdir% %%i in (*.tmp) do ren "%%i" "%%~ni.jpg"
Is there a better way?