blob: 549d0f0e3628af1cf437af46985b2ecb9fbe0cee [file] [log] [blame]
#!/usr/bin/env python3.8
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import argparse
import shutil
from pathlib import Path
def main():
params = argparse.ArgumentParser(
description="Copy all files in a directory tree and touch a stamp file")
params.add_argument("source", type=Path)
params.add_argument("target", type=Path)
params.add_argument("stamp", type=Path)
params.add_argument("--ignore_patterns", nargs="+")
args = params.parse_args()
shutil.rmtree(, ignore_errors=True)
ignore = None
if args.ignore_patterns:
ignore = shutil.ignore_patterns(*args.ignore_patterns)
shutil.copytree(args.source,, symlinks=True, ignore=ignore)
stamp = Path(str(args.stamp))
if __name__ == "__main__":