On Mon, 14 Jan 2002, Adi Stav wrote:

> On Mon, Jan 14, 2002 at 03:27:18PM +0200, Tzafrir Cohen wrote:
> > On 14 Jan 2002, Erez Doron wrote:
> >
> > > hi
> > >
> > > when i do 'ls -l' , i get the file modification time
> > > how do i get file creation time ?
>
> I don't think ls or any other tool can give you this information.
> Creation time is not one of the metadata kept about files. Ext2fs or
> Reiserfs might or might not have special features, but these would
> be filesystem specific.
>
> man ls to see which time information you can receive, though.
>
> > Try using 'find' instead of 'ls'. The option -printf is very powerful.
> >
> > I'm not sure, though, how to list only the files in the current directory,
> > and not in subdirectories.
>
> -maxdepth (nonportable, but then again so is -printf...)
>
> > For a light abuse of this feature of find, see
> > http://vipe.technion.ac.il/~tzafrir/Packages/mk_index.sh
>
> Nice... That's not abuse, that's the cleanest way to do it in shell
> CGI IMHO. Also check out the nonportable stat(1)...
>

Actually, Tzafrir's snippet may not work properly if the filename contains
such characters as double-quotes, ampersands and other characters that
confuse HTML. For intance:

shlomif@comnet55:~# find \"hello\" -printf "\"%p\"\n"
""hello""


> =================================================================
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]
>



----------------------------------------------------------------------
Shlomi Fish        [EMAIL PROTECTED]
Home Page:         http://t2.technion.ac.il/~shlomif/
Home E-mail:       [EMAIL PROTECTED]

"Let's suppose you have a table with 2^n cups..."
"Wait a second - is n a natural number?"


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to