LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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: 9,499

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

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 10:20 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration