I got a folder that has a whole bunch of subdirectories.
I need to delete all of them EXCEPT folders that has a marker file say example: DONOTDELETE.txt inside the said folders.
Is this possible?
Already had a presolution Thanks to Benoit
( find /testftp -type d ;
find /testftp -type f -iname DONOTDELETE.TXT -printf '%h'
) | sort | uniq -u | while read i
do
rm "$i/*";
done
but the output is:
rm: cannot lstat `/testftp/*': No such file or directory
rm: cannot lstat `/testftp/logs/*': No such file or directory