Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: -M

by grahm (Novice)
on Jun 29, 2002 at 18:56 UTC ( #178252=note: print w/replies, xml ) Need Help??


in reply to Re: del files that is 7 days or older
in thread del files that is 7 days or older

I'm curious as to how the -M operator works. Since Unix doesn't keep track of file creation dates, does -M check for the last modified? So in the example above would the given file be deleted if it wasn't modified in the last 7 days? I'm also assuming that one could use the -M to test directories as well. Is this true? :]

Replies are listed 'Best First'.
Re: Re: -M
by ariels (Curate) on Jun 30, 2002 at 06:52 UTC
    Take a look at stat. All the --something operators are just frontends for this function. UN*X keeps track of last access, last modification, and last inode change (often confused with creation time).

    -M looks at the mtime (modification time), and subtracts $^T (see perlvar). A better choice might be -C, which looks at ctime (inode change time). Still, that too just looks at the last time you changed something about the file "metadata": creation, permissions, and the like.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://178252]
help
Chatterbox?
[Corion]: A good daystart to everybody!
[Corion]: Just a quick poll - is anybody actively relying on https://perlmonks. pairsite.com/? I plan to retire that URL in favour of moving all our servers onto the same HTTPS certificate for perlmonks.{com, net,org}
[Corion]: Actually bsd_glob '{www.,}perlmonks .{com,net,org}', plus css.perlmonks.org I think
[Corion]: Sad that Let's Encrypt does not allow wildcard certificates, but they could be somewhat of a hassle to verify
[Discipulus]: since 2002 I just usewd www.perlmonks.org and good morning

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2017-09-26 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (292 votes). Check out past polls.

    Notices?