LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-30-2010, 08:01 PM   #1
simransab
LQ Newbie
 
Registered: Sep 2009
Posts: 23

Rep: Reputation: 15
Purge data command


Hi,

I have data in linux box that is transfered from 1 server to another..
Before transfer , i will keep a copy in "Backup" folder. What is the command to purge data older than 3 days?

Thanks,
Sab
 
Old 03-30-2010, 08:36 PM   #2
simransab
LQ Newbie
 
Registered: Sep 2009
Posts: 23

Original Poster
Rep: Reputation: 15
Guys, i found it:
/usr/bin/find /data/logs -name "*" -type f -mtime +31 -print -exec /bin/rm -f {} \;
 
Old 03-31-2010, 12:06 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
Glad you found it. Please mark as SOLVED (thread tools)
 
Old 03-31-2010, 12:50 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by simransab View Post
Guys, i found it:
/usr/bin/find /data/logs -name "*" -type f -mtime +31 -print -exec /bin/rm -f {} \;
Code:
-name "*"
is superfluous, and chances are that replacing the
Code:
-exec rm {} \;
with
Code:
 | xargs rm
will be quicker.


Cheers,
Tink
 
  


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
Feeding the output of "diff" or "cat" command to dpkg --purge kushalkoolwal Debian 9 06-19-2008 07:27 AM
aptitude- purge everything aquaboot Linux - Newbie 5 10-23-2007 08:53 PM
Purge HDD phantom_cyph Linux - Hardware 5 03-22-2007 02:12 AM
sendmail purge ! freelinuxcpp Linux - Networking 2 11-04-2003 03:11 AM
Purge Printer DelMerkin Linux - General 0 06-01-2003 11:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:05 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