diff --git a/zappa/core.py b/zappa/core.py index ae80b77e1..bd9b9891a 100644 --- a/zappa/core.py +++ b/zappa/core.py @@ -635,7 +635,9 @@ def splitpath(path): else: copytree(cwd, temp_project_path, metadata=False, symlinks=False) for glob_path in exclude_glob: - for path in glob.glob(os.path.join(temp_project_path, glob_path)): + # Use `recursive` to match paths deep in the directory tree + # https://github.com/zappa/Zappa/issues/1269 + for path in glob.glob(os.path.join(temp_project_path, glob_path), recursive=True): try: os.remove(path) except OSError: # is a directory @@ -767,7 +769,9 @@ def splitpath(path): # Cleanup for glob_path in exclude_glob: - for path in glob.glob(os.path.join(temp_project_path, glob_path)): + # Use `recursive` to match paths deep in the directory tree + # https://github.com/zappa/Zappa/issues/1269 + for path in glob.glob(os.path.join(temp_project_path, glob_path), recursive=True): try: os.remove(path) except OSError: # is a directory