File Modification Dates

David C Lawrence tale at pawl.rpi.edu
Thu May 11 12:17:29 AEST 1989


In article <207 at psgdc>, rg at psgdc (Dick Gill) writes:
[wants code to get readable modtime from filename]
Dick> I'll be happy to get a C program, shellscript or anything else
Dick> that I can call from a Bourne shell script.

In addition to Jonathan's modtime programme and Randal's perl script,
there is also "sls", available in the comp.unix.sources archives.  I
like sls a lot for scripts because I can choose my format string very
easily rather than pull apart the lines generated by a standard ls -l.
Examples:

Script started on Wed May 10 22:07:52 1989
(blank lines added for clarity in reading)

imagine:tale (1) ls -dl emacs
drwxr-xr-x  2 tale          512 May  4 14:28 emacs

imagine:tale (2) sls -dl emacs
drwxr-xr-x  2 tale           512 May 04 1989 14:28 emacs

imagine:tale (3) sls -dp %a emacs
May 09 1989 19:54

imagine:tale (4) sls -dp '%n: %c"%h %d"' {emacs,bin,src}
bin: Apr 27
emacs: May 04
src: May 10

imagine:tale (5) exit

script done on Wed May 10 22:09:04 1989

That was just extremely simple stuff, but that's what is great about
sls ... it's fast and it can do complex formatting or simple
formatting, all depending on your needs.

Dave
--
      tale at rpitsmts.bitnet, tale%mts at itsgw.rpi.edu, tale at pawl.rpi.edu



More information about the Comp.unix.questions mailing list