Because the DONOTLIST file is in the same directory as the VIDEO files you want to see, I don't know if there is a find
option for this case. (Specifically, I don't think -prune
helps here, except if all directories containing DONOTLIST is also supplied like vinilvijayan suggested.)
I do know that
find . -type d -print0 | bash -c 'while read -rd "" DIR ; do [ -f "$DIR/VIDEO" ] && [ ! -f "$DIR/DONOTLIST" ] && printf "%s\\n" "$DIR/VIDEO" ; done'
does work. It's probably not the shortest or most efficient way to go about it, though.
The idea is that find
just searches for all directories. It uses the ASCII NUL, zero byte, as the separator, so that all file names are handled correctly. The Bash snippet reads in the directories. If the directory contains file VIDEO but not file DONOTLIST, then it prints the path to the VIDEO file.
If you want the DONOTLIST file to affect both the current directory and subdirectories, I'd use GNU awk, since it handles RS="\0";FS="/+"
separators correctly. I'd construct an array of directories that contain the VIDEO file, and another of directories that contain the DONOTLIST file, both with trailing slashes, then remove the entries in the former array that begin with any entry in the latter. Finally, print the ones left over (adding the VIDEO to the directory path).