What i want to do is access a notepad, check the file names there in a a for loop.After getting the file name i want to see whether the particular file exists in a certain location.If exists then i want to move to another folder and publish 'file was removed' in the log file.
If not i need to echo the file could not be found.
I tried the following code but the if exist seems not to be working for some reason.
ECHO The files below were removed on > log.txt
date/t >> log.txt
time/t >> log.txt
FOR /F "skip=2 tokens=1,2* delims= " %%i in (C:\Users\kl\Documents\DELETEME\del.txt) do(
If Exist C:\Users\kl\Documents\DELETEME\West\%%i\%%j.txt (
move /y C:\Users\kl\Documents\DELETEME\West\%%i\%%j.txt C:\Users\kl\Documents\TEST & @echo %%i/%%j was deleted >> log.txt
echo. %%i/%%j could not be found >> log.txt
Without the if -else block it works fine.But i need the if-else block to get the complete log file.
Could anyone please help me to find why this is not working?
Thanks a lot in advance!!