LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 04-18-2005, 05:09 AM   #1
disinformation
Member
 
Registered: Sep 2003
Location: Wakefield, UK
Distribution: Slackware, Debian
Posts: 38

Rep: Reputation: 15
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.
 
Old 04-18-2005, 05:27 AM   #2
disinformation
Member
 
Registered: Sep 2003
Location: Wakefield, UK
Distribution: Slackware, Debian
Posts: 38

Original Poster
Rep: Reputation: 15
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
 
Old 04-18-2005, 05:28 AM   #3
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,645

Rep: Reputation: 146Reputation: 146
Hm, maybe as an example a simple

Code:
find /path-where-search-should-begin/ -name "*.mp3" -exec rm {} \;
could work?
 
Old 04-18-2005, 07:00 AM   #4
disinformation
Member
 
Registered: Sep 2003
Location: Wakefield, UK
Distribution: Slackware, Debian
Posts: 38

Original Poster
Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File Deletion mhkhalqani Linux - General 1 10-12-2005 03:08 AM
Automatic file deletion Azhrarn Linux - Newbie 5 08-30-2005 05:01 AM
secure file deletion shawn59 Linux - Security 2 06-12-2005 09:00 PM
Problem with file-deletion after a while JohnWayne Linux - General 3 07-26-2004 12:57 PM
Perl and file deletion berry Programming 4 05-29-2002 06:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration