If you have deleted a lot of files, and find it necessary to preform a restore, all your hard work is gone. I have a solution (for the next time).

Create a folder, to be used exclusively for this function. I named mine C:\Files. Prior to performing the restore, run BeforeRS.BAT which contains:

@echo off                              if exist c:\Files\*.* del /q c:\Files\*.*                              date /t > c:\Files\_ZZZZZZZ                              date /t > c:\Files\ZZZZZZZZ                              date /t > c:\Files\BeforeRS.log                              c:                              cd c:dir /b /on /s >> c:\Files\BeforeRS.log                              REM If you have additional drives:                              REM d:                              REM cd d:REM dir /b /on /s >> c:\Files\BeforeRS.log                              REM etc..                              exit
BeforeRS.BAT records every filename on your drive(s) in c:\Files\BeforeRS.log.

After the restore(s), run AfterRS.BAT which Contains:

@echo off                              setlocal                              date /t > c:\Files\AfterRS.log                              c:                              cd c:dir /b /on /s >> c:\Files\AfterRS.log                              REM If you have additional drives:                              REM d:                              REM cd d:REM dir /b /on /s >> c:\Files\AfterRS.log                              REM etc..                              c:                              cd c:\Files                              FC /LB9999 /1 BeforeRS.log AfterRS.log > DiffRS.tmp                              if exist DiffRSBefore.log del /q DiffRSBefore.log                              if exist DiffRSAfter.log del /q DiffRSAfter.log                              set file=DiffRSBefore.log                              for /f "Tokens=*" %%i in (DiffRS.tmp) do call :split "%%i"                               if exist DiffRS.log del /q DiffRS.log                              findstr /B /L /V /G:DiffRSBefore.log DiffRSAfter.log >> DiffRS.log                              start notepad.exe DiffRS.log                              endlocal                              goto end                              :split                              set line=%1                              set line=%line:"=%                              if /i "%line:~0,7%"

"***** B" goto before if /i "%line:~0,7%"

"***** A" goto After if /i "%line:~0,8%"

"c:\files" goto end if /i "%line:~0,5%"

"*****" goto end @echo %line% >> %file% goto end :before set file=DiffRSBefore.log goto end :after set file=DiffRSAfter.log :end
AfterRS.BAT performs the following functions:

1. Creates c:\Files\AfterRS.log with record for every filename on your drive(s).

2. Compares the BeforeRS.log with the AfterRS.log and writes DiffRS.tmp with the difference, using the FC command.

3. Separates the DiffRS.tmp into DiffRSBefore.log and DiffRSAfter.log, without the **** break images.

4. Uses the Findstr command to create DiffRS.log, containing only those files that were created by the restore.

5. Opens the DiffRS.log file in Notepad.

After inspecting DiffRS.log (and removing any folders/filenames you don't want deleted), run DiffRS.BAT, which contains:

@echo off                              setlocal                              c:                              cd c:\Files                              for /f "Tokens=*" %%i in (DiffRS.log) do call :parse "%%i"                              del /q *.*                              endlocal                              goto end                              :parse                              set file=%1                              set File=%file: "=%                              set File=%file:"=%                              @echo "%file%"                              del /f /q "%file%"                              :end
NOTE: The entire process takes a few minutes on my C: and D: drives (60K files).