|Dear all, I need your help please|
I have a batch file on windows.
I need to read from a text file a list of file names, the content of the text file is for example filename1;filename2;filename3
Then, i need to verify in a directory that is an input parameter in the script if the physical files which names are listed in the text file (filename1,filename2...)
exist in this directory; and write output to a text file a message indicating if each file is found or not.
The code i wrote but did not return the desired result is:
echo %date%,%time% Generate list of available and unavailable files >.\log.txt
SET /P src_dir="Enter the absolute path for Source Directory where physical Files are present (including the final \ ): [e.g: .\DATA\RD\]:"
SET /P src_file="Enter the name of file including the list of the filenames (including the extension e.g: .txt):"
ECHO The list of filenames are in %src_file%>>.\log.txt
ECHO The physical files are in %src_dir%>>.\log.txt
FOR /F "delims=;" %%A IN (%src_file%) DO(
set /a COUNTER+=1
IF EXIST %src_dir%%FILENAME% (
ECHO The file you are looking for %FILENAME% has been found in %src_dir%>>.\log.txt
) ELSE (
ECHO The file you are looking for %FILENAME% has not been found in %src_dir%>>.\log.txt
and the log displays the following:
Sat 03/27/2010,12:51:19.95 Generate list of available and unavailable files
The list of filenames are in FILES_LIST.txt
The physical files are in D:\Scripts\Data\10102010\