diff --git a/app/utils/system.py b/app/utils/system.py index c343c194..2c4e13a9 100644 --- a/app/utils/system.py +++ b/app/utils/system.py @@ -61,7 +61,9 @@ class SystemUtils: 移动 """ try: + # 当前目录改名 temp = src.replace(src.parent / dest.name) + # 移动到目标目录 shutil.move(temp, dest) return 0, "" except Exception as err: @@ -74,7 +76,11 @@ class SystemUtils: 硬链接 """ try: - dest.hardlink_to(src) + # link到当前目录并改名 + tmp_path = src.parent / dest.name + tmp_path.hardlink_to(src) + # 移动到目标目录 + shutil.move(tmp_path, dest) return 0, "" except Exception as err: print(str(err))