Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 10-05-2005, 08:29 PM   #1
Red Squirrel
Senior Member
Registered: Dec 2003
Distribution: Mint 17.1 KDE on workstation, CentOS 6.x on servers
Posts: 1,115

Rep: Reputation: 46
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
LQ Guru
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,854

Rep: Reputation: 310Reputation: 310Reputation: 310Reputation: 310
"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 '{}' \;

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


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 06:47 AM.

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