find command
Cameron Simpson
cs at zip.com.au
Tue Aug 28 23:35:44 UTC 2007
On 28Aug2007 16:08, Kaushal Shriyan <kaushalshriyan at gmail.com> 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 at zip.com.au> 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
More information about the users
mailing list