Fix copying of files.

This commit is contained in:
Leo Vasanko 2023-11-06 15:32:58 +00:00
parent dd1d85f412
commit c2be2ecd31

View File

@ -75,13 +75,16 @@ class Cp(ControlBase):
if not dst.is_dir(): if not dst.is_dir():
raise BadRequest("The destination must be a directory") raise BadRequest("The destination must be a directory")
for p in sel: for p in sel:
# Note: copies as dst rather than in dst unless name is appended. if p.is_dir():
shutil.copytree( # Note: copies as dst rather than in dst unless name is appended.
p, shutil.copytree(
dst / p.name, p,
dirs_exist_ok=True, dst / p.name,
ignore_dangling_symlinks=True, dirs_exist_ok=True,
) ignore_dangling_symlinks=True,
)
else:
shutil.copy2(p, dst)
ControlTypes = MkDir | Rename | Rm | Mv | Cp ControlTypes = MkDir | Rename | Rm | Mv | Cp