OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | |
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 | |
xhwang
2015/04/02 18:51:52
not used?
jrummell
2015/04/02 23:47:55
Done.
| |
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 | |
xhwang
2015/04/02 18:51:52
two empty lines per style guide
jrummell
2015/04/02 23:47:55
Done.
| |
23 def Main(argv): | |
24 if len(argv) == 3: | |
25 shutil.copyfile(argv[1], argv[2]) | |
26 elif len(argv) == 5: | |
27 shutil.copyfile(argv[1], argv[3]) | |
28 shutil.copyfile(argv[2], argv[4]) | |
29 else: | |
30 usage() | |
31 return 0 | |
32 | |
xhwang
2015/04/02 18:51:52
ditto
jrummell
2015/04/02 23:47:55
Done.
| |
33 if __name__ == '__main__': | |
34 sys.exit(Main(sys.argv)) | |
OLD | NEW |