move.py 344 B

123456789101112131415
  1. import os
  2. import sys
  3. # /script/move.py <src-1> <tgt-1> <src-2> <tgt-2> ... <src-n> <tgt-n>
  4. # renames src-1 to tgt-1, src-2 to tgt-2, ..., src-n to tgt-n.
  5. def main():
  6. assert len(sys.argv) % 2 == 1
  7. for index in range(1, len(sys.argv), 2):
  8. os.rename(sys.argv[index], sys.argv[index + 1])
  9. if __name__ == '__main__':
  10. main()