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

Re: date problem with ls -la --time=ctime



John Haxby wrote:

There are three timestamps maintained for files: mtime (modification time), atime (access time) and ctime (change time). ctime differs from mtime in that it records a change to the file that doesn't involve changing the files contents; chmod, chown, etc affect this.

If you want to delete files in /tmp that haven't been accessed (atime, ie read) in the last 15 minutes then

find /tmp -type f -amin +15 | xargs rm -f

That's going to annoy some people if they're expecting files to hang around in /tmp for any length of time, so this is probably better

find /tmp -type f -user notes -amin +15 | grep '^/tmp/eo-[^/]*tm$' | xargs rm -f

which will restrict the files to those owned by "notes" and, further, those that match a specific pattern. Check the find(1) man page to make sure I've got +15 right: I always test it to make sure!


Thanks, that's what I was looking for. It looks now this way: find /tmp -type f -user notes -iname "eo*" -amin +15 -exec ls -la {} --time=atime \;

But I still don't understand why the date of three days ago.
The file did not exist at that time.
I deleted all files this morning and confimed /tmp has no eo* files anymore.

Rainer


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