goodness0001
01-02-2002, 01:02 PM
Are there any scripts out there that will search for a particular file and if it finds it, it will delete it and would be driven by a simple cron job?
thanks
thanks
![]() | View Full Version : Search Script goodness0001 01-02-2002, 01:02 PM Are there any scripts out there that will search for a particular file and if it finds it, it will delete it and would be driven by a simple cron job? thanks priyadi 01-02-2002, 01:41 PM Originally posted by goodness0001 Are there any scripts out there that will search for a particular file and if it finds it, it will delete it and would be driven by a simple cron job? thanks something like this? find -type f -name "pattern" | xargs rm -f goodness0001 01-02-2002, 01:50 PM I presume "pattern" is the name of the file to delete. goodness0001 01-02-2002, 01:54 PM How do you get it to search a certain directory and all of its subdirectories for a particular file? find -type f -name "tester.txt" | xargs rm -f would only work from the directory it is executed in bitserve 01-02-2002, 02:50 PM Originally posted by goodness0001 How do you get it to search a certain directory and all of its subdirectories for a particular file? find -type f -name "tester.txt" | xargs rm -f would only work from the directory it is executed in find /path -type f -name "tester.txt" | xargs rm -f Of course I've always used -exec with find, instead of a pipe. goodness0001 01-02-2002, 05:10 PM That works great! |