On 2010-11-19, Peter Humphrey <pe...@humphrey.ukfsn.org> wrote: > On Friday 19 November 2010 16:40:37 Grant Edwards wrote: >> On 2010-11-19, Peter Humphrey <pe...@humphrey.ukfsn.org> wrote:
>>> Just to expose my ignorance again, would someone lift my blinkers >>> please? I'm recovering from an infection and my brain is stuck. >>> >>> It's time to start pruning old stuff from the website I run, which >>> has 2200 files in 200 directories. >>> >>> I'm trying to find old images like this: >>> find . -iname \*.jpg -exec ls '-cdl' {} \; | cut -d \ -f 5-10 >> >> It's not obvious how that command finds old images. Can you explain >> what it's supposed to do? > > The cut command simply strips off the permissions, owner, group and > file size. OK, but I still don't see how that "finds old image files", but whatever. > Never mind, anyway. I've done it by using separate steps instead of > trying to combine them. I'm still puzzled though at the different > behaviour of ls between command-line and execution by find. >>> find . -iname \*.jpg -exec ls '-cdl "--time-style=full-iso"' {} \; |\ >>> cut -d \ -f 5-10 What different behavior? That ls command doesn't work from the command line either: $ ls '-cdl "--time-style=full-iso"' foo ls: invalid option -- ' ' Try ls --help' for more information. The quotes cause both option specifiers '-cdl' and '--time-style=full-iso' to be passed to 'ls' as single string with whitespace in the middle of it. That's not how options are passed to Unix command line utilities. I think what you intended was $ ls -cdl --time-style=full-iso foo -rw-r--r-- 1 grante users 96 2010-11-19 11:44:45.000000000 -0600 foo IOW: $ find -iname '*.jpg' -exec ls -cdl --time-style=full-iso {} \; | cut -d ' ' -f 5-10 40369 2010-03-22 13:59:28.000000000 -0500 ./rfc2217-xon-xoff/right_cncbaron_small.jpg 110641 2010-03-23 10:21:16.000000000 -0500 ./rfc2217-xon-xoff/DMFreeWire-1-Port 300dpi 22330 2010-03-22 14:01:26.000000000 -0500 ./rfc2217-xon-xoff/clip_image002_0006.jpg [...] Note that your "cut" doesn't work right for filenames that contain spaces... -- Grant Edwards grant.b.edwards Yow! Maybe I should have at asked for my Neutron Bomb gmail.com in PAISLEY --