I am almost done with the script but this outputs directories. What I would like is to have an output of files. Anyway one of you guys wanna help me out? :)
#!bin/bash
( find /testftp/* -type d ;
find /testftp/* -type f -iname DONOTDELETE.TXT -printf '%h'
) | sort | uniq -u
Output is:
/testftp/logs
The output is the directory of where DONOTDELETE.TXT doesn't exist. It's pretty close. Just need to display the files.
-exec list {}/*instead of-printf '%h'. If it shows the correct files only, maybe you can try-exec rm -f {}/*(Caution: This is dangerous!). Also, this maybe useful. – ADTC Feb 24 '12 at 17:46( find /testftp -type d ; find /testftp -type f -iname DONOTDELETE.TXT -exec list {} \; ) | sort | uniq -uOutput is : ` find: list: No such file or directory /testftp /testftp/logger /testftp/logs ` DONOTDELETE.TXT is under ` /testftp/logger ` – JoyIan Yee-Hernandez Feb 24 '12 at 17:54lsnotlist(always forget it!) – ADTC Feb 24 '12 at 18:14