aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/move.py
blob: f38e88a40651599513405b2529ef95cc0e518644 (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
import os
import sys

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()