blob: 220c9190bdd5b865ab3eabdc2e4092af96e8bea2 [file] [log] [blame]
George Kulakowski793afc22016-02-10 11:52:39 -08001# 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
5import os
6import shutil
7import sys
8
9
10def 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
27def main():
28 source_path = sys.argv[1]
29 target_path = sys.argv[2]
30 copytree(source_path, target_path)
31
32
33if __name__ == '__main__':
34 main()