cp.py 401 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env python
  2. #
  3. # Copyright 2016 Google Inc.
  4. #
  5. # Use of this source code is governed by a BSD-style license that can be
  6. # found in the LICENSE file.
  7. import os
  8. import shutil
  9. import sys
  10. src, dst = sys.argv[1:]
  11. if os.path.exists(dst):
  12. if os.path.isdir(dst):
  13. shutil.rmtree(dst)
  14. else:
  15. os.remove(dst)
  16. if os.path.isdir(src):
  17. shutil.copytree(src, dst)
  18. else:
  19. shutil.copy2(src, dst)