In cmd.exe, the FOR / F% command of the IN variable ( file_name ) DO should provide you with what you want. This reads the contents of the file name (and there may be several file names) one line at a time, placing the line in the% variable (more or less, do HELP FOR on the command line). If no one else executes the script command, I will try to execute.
EDIT: my attempt for a cmd.exe script that asks:
@echo off rem first arg is the file containing filenames rem second arg is the target directory FOR /F %%f IN (%1) DO IF EXIST %2\%%f ECHO %%f exists in %2
Note. The script above should be a script; The FOR loop in a .cmd or .bat file, for some strange reason, should have a double percentage sign in front of its variable.
Now, for a script that works with bash | ash | dash | sh | ksh:
filename="${1:-please specify filename containing filenames}" directory="${2:-please specify directory to check} for fn in `cat "$filename"` do [ -f "$directory"/"$fn" ] && echo "$fn" exists in "$directory" done
tzot
source share