1833758 Members
2529 Online
110063 Solutions
New Discussion

problem find

 
SOLVED
Go to solution
Kavitha
Occasional Contributor

problem find

Hi !
Iam using the find command in the following way,
# find . -mtime 15 -exec ll {} \;. My idea behind this is to list all the files that are older than 15days. But the resule of this command is that Iam getting only the files of Dec 17 2001. Even though the directory has files of Jan-Nov also Dec.

Can anybody help me understanding this.

regards,
3 REPLIES 3
John Palmer
Honored Contributor
Solution

Re: problem find

Try -mtime +15

Regards,
John
Robin Wakefield
Honored Contributor

Re: problem find

Hi,

Also, you might want to put "-type f" too, since if a directory is older than 15 days, as well as the files within it, you'll get repeated output. Or else use "ll -d".

find . -mtime +15 | xargs ll -d

or

find . -mtime +15 -type f | xargs ll

is what I'd use (xargs is more efficient than -exec).

Rgds, Robin.
Darrell Allen
Honored Contributor

Re: problem find

As info...

"find -mtime +n" selects files with a modification time > n days old.

"find -mtime -n" selects files with a modification time < n days old.

"find -mtime n" selects files with a modification time for the 1 day period that begins n days in the past.

"n" days is actually "n x 24" hours from the time you run the find command.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)