LinuxQuestions.org
Register a domain and help support LQ
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 10-05-2005, 08:29 PM   #1
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 782

Rep: Reputation: 36
delete files older then a month?


I found this command which aparantly lists files older then 30 days:

find -mtime +30

Problem is, after it's done, it just sits there, instead of going back to the prompt. Also, how would I use this command to delete the files that are listed?

Also, when rsync runs, does it update the date on existing files or does it only update the date if the file is changed?
 
Old 10-05-2005, 10:54 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,536

Rep: Reputation: 178Reputation: 178
"how would I use this command to delete the files that are listed?"

Use this command to feed the filenames into an exec. Something like:

find -mtime +30 -exec rm '{}' \;

See:
man find

"Problem is, after it's done, it just sits there, instead of going back to the prompt."

No idea. Try adding a semi colon and see if that makes any difference.

find -mtime +30 ;

-------------------------
Steve Stites
 
  


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
Cron Question - Delete files in a dir older than 48 hours? t3___ Linux - Newbie 5 10-11-2011 03:42 AM
delete files older than 30 days using cronjob latheesan Linux - Newbie 5 06-14-2005 02:40 PM
delete files in server that is older than 30 days using cronjob latheesan *BSD 2 06-14-2005 12:37 PM
Finding six month old files arockia Linux - Software 11 09-01-2004 09:37 AM
Starting day of month, month length chrisk5527 Programming 2 03-03-2004 04:03 PM


All times are GMT -5. The time now is 04:11 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration