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



Hamilton C shell | Free Updates | Free Demo Software | Win32 Training
Y2K | Customer Testimonials | On-line Hamilton C shell User Guide
Home | Email | Support | Company Profile | Distributors | Links



Copyright © 1997-2001 by Hamilton Laboratories. All rights reserved.
You are visitor number 497. This page was last modified August 14, 2001.