Basically I just want go through every line in my PE.tmp file and lookup those in test.txt and just call another procedure if found or not.
Script
SET "sourcedir=D:\"
SET "FN=%sourcedir%test.txt"
FOR /F "TOKENS=1 DELIMS=." %%A IN (PE.tmp) DO (
FOR /F "TOKENS=1 DELIMS=." %%A IN ('FINDSTR /L /c:"%%A" "%FN%"' set "valpdf=%%A") DO IF %ErrorLevel% EQU 0 (
call :found
) ELSE (
call :notfound
)
)
:found
echo %valpdf%.PDF - %DATE% %time% - Found > LOG.txt
type log.txt >> log1.txt
:notfound
echo %valpdf%.PDF - %DATE% %time% - Not Found > LOG.txt
type log.txt >> log1.txt
Test.txt
Remote working directory is /
New local directory is D:\PP
local:PP65205861.PDF => remote:/PP65205861.PDF
Listing directory /
-rw------- 1 200 100 12414 June 03 20:05 PP65205861.PDF
New local directory is D:\PE
local:PP65205862.PDF => remote:/PP65205862.PDF
Listing directory /
-rw------- 1 200 100 6763 June 03 20:05 PP65205862.PDF
New local directory is D:\TEMP
Listing directory /
*.PDF: nothing matched
PE.tmp
PP65205861.PDF
PP65205862.PDF
My Result
.PDF - 05/05/2017 10:56:39.59 - Found
.PDF - 05/05/2017 10:56:39.60 - Not Found
Desired Result
PP65205861.PDF - 05/05/2017 10:56:39.59 - Found
PP65205862.PDF - 05/05/2017 10:56:39.59 - Found
Script that work
SET "sourcedir=D:\"
SET "FN=%sourcedir%test.txt"
FOR /F "delims=" %%f in (PE.tmp) do (
FINDSTR /M /C:%%f %FN%>NUL:
IF errorlevel 1 (
ECHO %%f - %DATE% %time% >> log.txt
) ELSE (
ECHO %%f - %DATE% %time% >> log.txt
)
)