Zsh Mailing List Archive
Messages sorted by:
Re: Extract CTIME in zsh 4.2.3?
- X-seq: zsh-users 16143
- From: skullnobrains <alexb_org@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Extract CTIME in zsh 4.2.3?
- Date: Tue, 26 Jul 2011 15:24:07 +0000 (UTC)
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <95E667D6-6AE4-4CDA-B420-30033315C886@tntluoma.com> <email@example.com> <16D53E3C-D453-414D-AB6C-3280FF5573CF@tntluoma.com> <firstname.lastname@example.org> <20050822153529.GA66@DervishD>
> In fact, it is not present in SUS. Probably it is present only
> for a few filesystems, so it has to be retrieved in a non-portable
> way. Under Linux, I don't recall now of any filesystem that
> implements creation time for entries. It's not an operating system
> problem, is a filesystem problem. Even in the case you can write
> code for some UNIX flavour to retrieve that data, it will only work
> for some particular filesystem. The VFS on top of that will only
> store the st_atime, st_mtime and st_ctime values in the metadata.
actually GNU/linux is definitely the only unix-like OS where you are likely to
be unable to retrieve a file's ctime.
"stat -f %c FILE" should be portable on any BSD os, including macosx and
probably on any solaris distribution as well.
you will need to use the "date" command in order to format the date as stat will
return a timestamp. each system is likely to implement shorthands to retrieve
the date in human readable form but in a less likely portable way.
the shell you are using will probably make no difference as stat is usually
either not a builtin or is system-dependant, but you can use `which stat` if you
want to make sure the builtin will not be used.
this is very sad, and i'd like to make clear i'm not looking forwards to start a
flame war, but if you are running linux trying to make something portable, you
probably should forget about using the shell, and switch to something like perl.
on the other hand ls + sed is more than likely to be portable under any OS, but
what you will retrieve in linux will probably not be the actual ctime of the file
Messages sorted by: