![]() | OldFileMover |
UserPreferences |
GMS NOC Docs | FrontPage | RecentChanges | TitleIndex | Help |
Some pseudocode for a shell script that it would be nice to have:
alarm looks like line10.0 has old files
in general, the directory has pairs of files, like
HA7963040 HA7963040.TAG
I'm going to call a pair of files of the form FOO123.TAG and FOO123 a filepair, so where you see filepair, that means that BOTH were found
command should look like mvold 10.0
foreach directory in '/usr/line10.0/backup' '/usr/spool/line10.0/output' cd directory foreach file that ends with a '.' sometimes the TAG doesn't get created properly, and instead of file and file.tag, you get 'file' and 'file.' in that case, delete both rm 'file.' 'file' foreach file in filepair if both files are less than 120 bytes rm filepair now it gets complicated the command 'gaf -ux filename' takes an EBCDIC file and writes it to stdout as ASCII. The first line of output looks like Reading file: filename the second line may look several different ways, but the two most common are IH*00100*ORDNET*TOLITUSO*ZZ*ORDERNET*ZZ*ATTGMS*011119*163325*ES*005718651*P~ISA and +:SIGNON USERNAME=TDSYNCB PASSWORD=KARIJIXA RECL=100 in the first case, we want to parse out "ordnet" in the second case, we want "tdsyncb" if the line cannot be parsed, we default to "atspud1" echo the line to the user and then do something like this: *** Move to ordnet? if the user presses enter, 'y' or 'yes', set movedir to (e.g.) '/usr/ordnet/savefiles/status' if the user enters anything else, change the default to what they enter, and prompt again once they are satisfied, check to see if movedir exists. if it does, move the filepair there. if it doesn't, set movedir = '/usr/atspud1/savefiles/status' warn the user, and move the filepair there make a record of what's been moved where. when all files have been dealt with, print a summary of what files were moved from where to where