I have this code:
FOR /F "tokens=*" %%a IN ('type %LIST%') DO (
FOR /R "%SEARCH_DIR%" %%f IN (*%%a*) DO (
set "Name=%%~a"
set "Filename=%%~nf"
IF "!Name!"=="!Filename!"(
echo !Name! >> "%FOUND%" :: name of files that i found in the directory
) ELSE(
echo !Name! >> "%NOFOUND%" :: name of files that i don`t found in the directory
)
SET "SRC=%%~dpf"
SET DEST=!SRC:%SEARCH_DIR%=