blob: 0154294505b16998088b934dfd42c3c3f7b5f309 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import os
import sys
# Explicitly enable local imports
# Don't forget to add imported scripts to inputs of the calling command!
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import process_command_files as pcf
# /script/move.py <src-1> <tgt-1> <src-2> <tgt-2> ... <src-n> <tgt-n>
# renames src-1 to tgt-1, src-2 to tgt-2, ..., src-n to tgt-n.
def main():
args = pcf.get_args(sys.argv[1:])
assert len(args) % 2 == 0, (len(args), args)
copied = set()
for index in range(0, len(args), 2):
assert args[index] not in copied, "Double input detected for file: {}".format(args[index])
os.rename(args[index], args[index + 1])
copied.add(args[index])
if __name__ == '__main__':
main()
|