Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] Finding old files
Date: Fri, 19 Nov 2010 17:23:27
Message-Id: 201011191923.39529.alan.mckinnon@gmail.com
In Reply to: [gentoo-user] [OT] Finding old files by Peter Humphrey
1 Apparently, though unproven, at 18:29 on Friday 19 November 2010, Peter
2 Humphrey did opine thusly:
3
4 > Hello list,
5 >
6 > Just to expose my ignorance again, would someone lift my blinkers
7 > please? I'm recovering from an infection and my brain is stuck.
8 >
9 > It's time to start pruning old stuff from the website I run, which has
10 > 2200 files in 200 directories.
11 >
12 > I'm trying to find old images like this:
13 > find . -iname \*.jpg -exec ls '-cdl' {} \; | cut -d \ -f 5-10
14 >
15 > But this excludes the year (even though listing an old file manually
16 > shows the year if it's over 12 months old), so I can't use that to
17 > decide. If I do this:
18 > find . -iname \*.jpg -exec ls '-cdl "--time-style=full-iso"' {} \; |\
19 > cut -d \ -f 5-10
20 > I get an error message: ls: invalid option -- ' '
21 >
22 > Why does ls differ when executed by find from on the command line?
23 >
24 > Is there a simple way to do this? Ideally I'd like a chronologically
25 > ordered list of the files. I have noatime set in fstab, so I'll have to
26 > rely on creation or modification date.
27
28
29 There's no such thing as file creation time on Unix - that has never been
30 recorded.
31
32 ctime is the time the *inode* was last changed
33 mtime is the time the *file contents* was changed
34
35 Having said that it seems to me you want the -mtime option to find, followed
36 by -ls to display everything in detail.
37
38
39
40 --
41 alan dot mckinnon at gmail dot com