Table of Contents
Previous Sample | List of Samples | Next Sample

Timestmp.csh


#  Extract a timestamp from a file or directory in the format
#  needed by touch.

#  Copyright (c) 1994-2000 by Hamilton Laboratories.  All rights reserved.

proc timestmp( file )
   local j, t, month, year
   set t = `ls -L! $file`:1-4:gS/:0/:/:gs/:/ /
   @ month = 1
   foreach j (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
      if (j == t[0]) break
      @ month++
   end
   @ year = substr(t[5], 3)
   return $printf("%02d%02d%02d%02d%02d%02d", ^
      month, t[1], t[2], t[3], t[4], year)
end

timestmp $argv



Previous Sample | List of Samples | Next Sample
Table of Contents



Copyright © 1988-2003 by Hamilton Laboratories. All rights reserved.