OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | |
ddorwin
2015/03/28 04:00:11
2015 unless you copied this file.
jrummell
2015/04/01 23:37:37
Done.
| |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import os | |
7 import shutil | |
8 import sys | |
9 | |
10 def usage(): | |
11 print """\nUsage: %s <input_files> <output_files> | |
12 | |
13 Copies 1 or 2 <input_files> to matching <output_files> | |
14 | |
15 Examples: | |
16 Copy 1 file: | |
17 ./copy_with_rename.py in out | |
18 Copy 2 files: | |
19 ./copy_with_rename.py in1 in2 out1 out2 | |
20 """ % sys.argv[0] | |
21 sys.exit(1) | |
22 | |
23 def Main(argv): | |
24 if len(argv) == 3: | |
25 return shutil.copyfile(argv[1], argv[2]) | |
26 elif len(argv) == 5: | |
27 return shutil.copyfile(argv[1], argv[3]) | |
28 return shutil.copyfile(argv[2], argv[4]) | |
xhwang
2015/03/30 17:23:50
return twice?
jrummell
2015/04/01 23:37:37
Fixed.
| |
29 else: | |
30 usage() | |
31 | |
32 if __name__ == '__main__': | |
33 sys.exit(Main(sys.argv)) | |
OLD | NEW |