Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-18-2005, 05:09 AM
|
#1
|
Member
Registered: Sep 2003
Location: Wakefield, UK
Distribution: Slackware, Debian
Posts: 38
Rep:
|
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.
|
|
|
04-18-2005, 05:27 AM
|
#2
|
Member
Registered: Sep 2003
Location: Wakefield, UK
Distribution: Slackware, Debian
Posts: 38
Original Poster
Rep:
|
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
|
|
|
04-18-2005, 05:28 AM
|
#3
|
Senior Member
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 current
Posts: 1,649
Rep: 
|
Hm, maybe as an example a simple
Code:
find /path-where-search-should-begin/ -name "*.mp3" -exec rm {} \;
could work?
|
|
|
04-18-2005, 07:00 AM
|
#4
|
Member
Registered: Sep 2003
Location: Wakefield, UK
Distribution: Slackware, Debian
Posts: 38
Original Poster
Rep:
|
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 01:16 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|