Re: find command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28Aug2007 16:08, Kaushal Shriyan <kaushalshriyan@xxxxxxxxx> wrote:
| find . -name "url*.0" -mtime "Apr" | wc -l
| 
| find: invalid argument `Apr' to `-mtime'
| 
| I am looking out for the month of Apr only so how would the command -mtime
| look like

The -mtime option takes _days_, not a date. Figure out how many days ago
01may2007 was, and how many days ago 01apr2007 way. Eg:

  $ date +%j                    # today
  241
  $ date -d 2007-05-01 +%j
  121
  $ date -d 2007-04-01 +%j
  091

So April lies between 120 and 150 days ago. So:

  find . -name "url*.0" -mtime +120 -mtime -150

See "man date" and "man find" for details.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

You need a brain the size of a melon to take it [the Isle of Man TT course]
all in and one the size of a walnut to actually race it.        - Peter Salmon


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux