# /u/sy/beebe/bin/ftp-dates.awk, Mon Jan 15 14:04:13 1990 # Edit by Nelson H.F. Beebe # ======================================================================== # # Read a 00tdir.lst file retrieved from TOPS-20, and for each file # listed that is found in the current directory, output a command to set # the file modification time to match the TOPS-20 master copy. This # script needs the AT&T System V version of touch; the Berkeley version # lacks the capability to set time stamps. # # Usage: # awk -f ftp-dates.awk <00tdir.lst >foo.sh # source foo.sh # # Typical input 00tdir.lst file: # # PS: # 00README.TXT.51;P525252 6 13650(7) 15-Jan-90 13:59:05 BEEBE # 00NEWS.TXT.4;P777752 1 693(7) 15-Jan-90 13:17:21 BEEBE # ... # TEX-FROM-WORD-PROCESSOR-FORMATS.TXT.3;P777752 # 2 3212(7) 28-Dec-89 09:37:03 BEEBE # # Total of 659 pages in 36 files # # [15-Jan-1990] # ======================================================================== BEGIN {} { if (substr($0,1,3) == " ") # ignore directory name line next; if (substr($0,1,9) == " Total of") # ignore summary line next; filename = $1; if (NF == 1) # continued line { getline; filedate = $3; # dd-mon-yy filetime = $4; # hh:mm:ss } else # normal line { filedate = $4; # dd-mon-yy filetime = $5; # hh:mm:ss } if (NF < 5) # discard unrecognized lines next; filename = substr(filename,1,index(filename,";")-1); # discard protection field for (k = length(filename); k > 0; --k) # find .extension { if (substr(filename,k,1) == ".") break; } if (substr(filename,k-1,1) == ".") --k; # discard null extension filename = substr(filename,1,k-1); # discard .extension for (k = 1; k <= length(filename); ++k) # convert to lower case { n = index("ABCDEFGHIJKLMNOPQRSTUVWXYZ",substr(filename,k,1)); if (n > 0) filename = substr(filename,1,k-1) \ substr("abcdefghijklmnopqrstuvwxyz",n,1) substr(filename,k+1); } if (length(filedate) < 9) filedate = "0" filedate; # convert d-mon-yy to dd-mon-yy # output /usr/5bin/touch -c -m MMDDhhmmyy filename printf("/usr/5bin/touch -c -m '%02d%02d%02d%02d%02d' '%s'\n",\ 1 + index("JanFebMarAprMayJunJulAugSepOctNovDec",substr(filedate,4,3))/3,\ substr(filedate,1,2),\ substr(filetime,1,2),\ substr(filetime,4,2),\ substr(filedate,8,2),\ filename); } END {}