Solved Search for file in dir & print missing files

November 17, 2011 at 07:23:20
Specs: Win7, 4gb
Hi, what would be the best way to get a batch file to search for predetermined files in a directory and redirect the filenames of those files NOT found to a file?

Example:

The log directory contains:
FileA
FileB
FileC

The bat file searches for:
FileA
FileB
FileC
FileD
FileE

The output file lists the files not found:
FileD
FileE


thanks!

Thanks,
REMGU


See More: Search for file in dir & print missing files

Report •


#1
November 17, 2011 at 08:03:20
✔ Best Answer
Setup a text file, e.g. filelist.txt, holding the file names to be searched one on each line. Then

@echo off
pushd Your_Directory
for /F "delims=*" %%j in (filelist.txt) do dir "%%j" >nul || echo.%%j>> "Other_Dir\result.txt"
popd


Report •

#2
November 17, 2011 at 10:55:14
that did it thanks

Thanks,
REMGU


Report •

Related Solutions


Ask Question