LinuxQuestions.org

LinuxQuestions.org (http://www.linuxquestions.org/questions/index.php)
-   Linux - Software (http://www.linuxquestions.org/questions/forumdisplay.php?f=2)
-   -   File Deletion Script (http://www.linuxquestions.org/questions/showthread.php?t=314432)

disinformation 04-18-2005 05:09 AM

File Deletion Script
 
Hello all, long time since i have posted here hope everyone is well;

I'm wanting to make a little script that can be run as a cron job, the scripts should;

mount my organisations file server;
scan for "contraband" i.e. exe's mp3's
delete the files

Can anyone point me in the right direction for the commands i would need to use for finding and then deleting.

I will admit i haven't invested much time into this yes, am just under a bit of pressure and any help would be greatly appreciated.

Thanks in advance.

disinformation 04-18-2005 05:27 AM

Sorry i should add;

I know how to mount the fileservers share, and i know how to search for the files i need with the find command,

i really need help with passing the output to the delete command

titopoquito 04-18-2005 05:28 AM

Hm, maybe as an example a simple

Code:

find /path-where-search-should-begin/ -name "*.mp3" -exec rm {} \;
could work?

disinformation 04-18-2005 07:00 AM

hi thanks for your help;

i came to a similar conclusion myself, but using the xargs command with the -0 option.

find /server1/home -name "*.mp3" | xargs -0 rm -f


All times are GMT -5. The time now is 09:29 AM.