mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
archive: remove path folder itself when remove paramater is true (#1083)
* Remove paths folders themselves * Add changelog * Add remove integration test * Check excluded file
This commit is contained in:
parent
d95910963b
commit
9ccc0464ff
4 changed files with 136 additions and 0 deletions
|
@ -453,6 +453,13 @@ def main():
|
|||
except OSError as e:
|
||||
errors.append(to_native(b_path))
|
||||
|
||||
for b_path in b_expanded_paths:
|
||||
try:
|
||||
if os.path.isdir(b_path):
|
||||
shutil.rmtree(b_path)
|
||||
except OSError as e:
|
||||
errors.append(to_native(b_path))
|
||||
|
||||
if errors:
|
||||
module.fail_json(dest=dest, msg='Error deleting some source files: ', files=errors)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue