#!/bin/env python from glob import glob from sys import argv, exit from string import split, lower, find from os import system program = 'copyScript' version = '1.0' verdate = '20110627' print '\nThis is %s version %s %s\n' % (program, version, verdate) if len(argv) == 1: print '' print 'Usage: %s ' % argv[0] print '' print 'This program will match all files of the form .XX.py' print 'and send such files to computer XX-cc' print '' exit(0) elif len(argv) == 2 and find(argv[1], '.py') < 0: files = glob(argv[1]+'.??.py') else: files = argv[1:] for f in files: s = split(f, '.') stn = lower(s[-2]) if stn == 'gb': cc = 'gb-cc.gb.nrao.edu' else: cc = '%s-cc' % stn print 'Sending %s to %s' % (f, cc) cmd = 'scp %s vlbamon@%s:/export/home/cc/vlba/scripts' % (f, cc) print 'Executing: %s' % cmd system(cmd)