zsh-users
 help / color / mirror / code / Atom feed
From: skullnobrains <alexb_org@hotmail.com>
To: zsh-users@zsh.org
Subject: Re: Extract CTIME in zsh 4.2.3?
Date: Tue, 26 Jul 2011 15:24:07 +0000 (UTC)	[thread overview]
Message-ID: <loom.20110726T170541-435@post.gmane.org> (raw)
In-Reply-To: <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


      reply	other threads:[~2011-07-26 15:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-21 20:01 Timothy Luoma
2005-08-21 20:11 ` Shawn Halpenny
2005-08-22  4:44   ` Timothy Luoma
2005-08-22  5:27   ` Timothy Luoma
2005-08-22 15:21     ` Bart Schaefer
2005-08-22 18:44       ` SOLVED (more or less) " Timothy Luoma
2005-08-22 15:24     ` Shawn Halpenny
2005-08-22 15:35       ` DervishD
2011-07-26 15:24         ` skullnobrains [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20110726T170541-435@post.gmane.org \
    --to=alexb_org@hotmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).