Question : How can I compare Files in a Directory with a Text File List using a DOS Batch File?

How can I compare Files in a Directory with a Text File List using a DOS Batch File?  I have a Text File with a UNC File Path for Each File I should have in my Subdirectories indexed and listed per line.  So it looks like:
C:\Archive\File1.xls
C:\Archive\Finance\File1.doc
C:\Archive\Finance\File2.pdf

There are Hundreds of Files Indexed in this simple "ArchiveFiles.TXT" text file.
I need to compare the files listed in this Text File to the Actual Files on the Hard Drive to make sure no files are missing or deleted or renamed.  I want to do a Comparison and if any Files Exist in the Directory or Subdirectory that are Not also listed in my Text File,  I want to save that list as a Seperate File that shows me the difference between my "ArchiveFiles.txt" file and the actual Directory "C:\Archive"  or it could be any other Directory I want to compare my List with.

The Path is actually on a Network drive and has a different name, but if you can write a Batch Script that compares the Directory and Subfolders to those listed in a Text File  (If Exists??) and that outputs the Difference,  I would greatly appreciate it.   I think someone deleted a few files from the network share, but I need a quick way to check against our Index of files.  Thanks.

Answer : How can I compare Files in a Directory with a Text File List using a DOS Batch File?

Oh and not listed.

Set archive=C:\ArchiveFiles.TXT
if exist ArchiveExist.txt del ArchiveExist.txt
if exist ArchiveDoesNotExist.txt del ArchiveDoesNotExist.txt
if exist NotInArchive.txt del NotInArchive.txt


for /f "tokens=*" %%a in ('type "%archive%"') do (
     if exist "%%a" (
          Echo %%a>>ArchiveExist.txt
    ) else (
          Echo %%a>>ArchiveDoesNotExist.txt
    )
)

for /r "C:\Archive" %%a in (*.*) do (
    find /i "%%a" "%archive%"
    if errorlevel 1 ECHO %%a>>NotInArchive.txt
)
Random Solutions  
 
programming4us programming4us