Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-02-2011, 05:44 PM   #1
LQ Newbie
Registered: Jan 2011
Posts: 7

Rep: Reputation: 0
Post Find command with -mtime +15 or -15 days??

Hi everybody

I am writing a bash script which includes the find (and rm command with exec) command the options -mtime -15 or +15 so that files older 15 days must be deleted from the home directory. I think that -mtime +15 should be ok, but in which case does the option -mtime -15 really come in handy?? go back 15 days until today's date??

plz help
thanks in advance
Old 02-02-2011, 05:48 PM   #2
Senior Member
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
From the manual page for find.
Numeric arguments can be specified as

+n for greater than n,

-n for less than n,

n for exactly n.
So -mtime -15 would result in selecting files with less than 15 days since modification.

Last edited by stress_junkie; 02-02-2011 at 05:49 PM.


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
[SOLVED] Command to find only mtime ddenton Linux - General 3 08-12-2010 02:57 PM
[SOLVED] Command to find all of the files which have been accessed within the last 30 days sunilup Linux - Newbie 1 05-16-2010 01:32 AM
mtime option in find command ahmedb72 Linux - Newbie 7 06-23-2009 09:48 AM
alternative command for "find -mtime " sspisharody Linux - Newbie 2 02-13-2009 04:41 PM
using find to compare file mtime with another file's mtime TheFueley Linux - Newbie 1 12-23-2008 08:06 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:42 PM.

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