[X-Unix] extract CTIME from the commandline?

Xavier Noria fxn at hashref.com
Sun Aug 21 13:19:10 PDT 2005


On Aug 21, 2005, at 21:40, Timothy Luoma wrote:

> I want to extract the created time from a number of files  
> (preferably in yyyy-mm-dd format).
>
> Anyone know a command to do that?

You can get it with this command:

     stat -f "%Sc" -t "%Y-%m-%d" filename

or the same with the filename prefixed:

     stat -f "%N: %Sc" -t "%Y-%m-%d" filename

so that you can plug it into a loop and distinguish them, if you need  
to, for instance:

     find . -type f -print0 | \
     xargs -0 stat -f "%N: %Sc" -t "%Y-%m-%d"

-- fxn


More information about the X-Unix mailing list