3
"""Cross-platform os tools: files/directories manipulations
9
ostools.py copytodir FILES... DIR
10
copy files to specified directory
12
ostools.py remove [FILES...] [DIRS...]
13
remove files or directories (recursive)
35
if cmd == 'copytodir':
37
print "Usage: ostools.py copytodir FILES... DIR"
41
if not os.path.exists(todir):
43
if not os.path.isdir(todir):
44
print "Error: Destination is not a directory"
48
for possible_glob in argv:
49
files += glob.glob(possible_glob)
52
dest = os.path.join(todir, os.path.basename(src))
53
shutil.copy(src, dest)
54
print "Copied:", src, "=>", dest
60
print "Usage: ostools.py remove [FILES...] [DIRS...]"
64
for possible_glob in argv:
65
filesdirs += glob.glob(possible_glob)
71
elif os.path.isfile(i):
84
if __name__ == "__main__":