I have a drive with several thousands of pictures on it. I've copied it all to another drive in which I've been organizing them slowly over several months. I've discovered a ton of corrupted files but found that the on the original drive, they aren't corrupted.
What I'd like to do is have a batch file that will read filenames from a text file and search the original drive for the filename, then copy it to a specified folder.
Since the original drive is unsorted, there could be duplicates so I'd like to copy all of the copies of that filename to the new folder. I have a script that might do it (see below) but it doesn't seem to be working because of the long filenames. For example, "
2008-06-27 02.06.37.jpg" ... the script will search for "
2008-06-27" instead of the full filename.
Any thoughts on how to fix this?
Here is my work that I have so far that's still not working as expected:
@ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION cls set dest=F:\ERRORS\recovered for /f %%f in (F:\ERRORS\errorlist.txt) do ( set i=1 for /f "tokens=*" %%F IN ('dir /S /B /A:-D "%%f"') Do ( for %%N in ("%%F") Do ( set name=%%~NN set ext=%%~XN ) copy "%%F" "%dest%\!name!_!i!!ext!" set /A i=!i!+1 ) ) ENDLOCAL