OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import os | |
6 import shutil | |
7 import sys | |
8 | |
9 | |
10 def copytree(source_dir, target_dir): | |
11 """Copy a tree. | |
viettrungluu
2016/02/10 15:59:31
nit: 2-space indents!*#@#@$?! :(
kulakowski
2016/02/10 19:52:35
Done.
| |
12 | |
13 This is needed because shutil.copytree requires that |target| not | |
14 exist yet. | |
15 | |
16 """ | |
17 | |
18 for file in os.listdir(source_dir): | |
19 source = os.path.join(source_dir, file) | |
20 target = os.path.join(target_dir, file) | |
21 if os.path.isfile(source): | |
viettrungluu
2016/02/10 15:59:31
Things will get sad if "foo" was a file and is cha
| |
22 shutil.copy(source, target) | |
23 else: | |
24 copytree(source, target) | |
25 | |
26 | |
27 def main(): | |
28 source_path = sys.argv[1] | |
29 target_path = sys.argv[2] | |
30 copytree(source_path, target_path) | |
31 | |
32 | |
33 if __name__ == '__main__': | |
34 main() | |
OLD | NEW |