| George Kulakowski | 793afc2 | 2016-02-10 11:52:39 -0800 | [diff] [blame] | 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. |
| 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): |
| 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() |