|
@ -49,7 +49,12 @@ for directory in directories_to_move: |
|
|
# 检查源目录是否存在 |
|
|
# 检查源目录是否存在 |
|
|
if os.path.isdir(source_path): |
|
|
if os.path.isdir(source_path): |
|
|
# 使用shutil.move来移动目录 |
|
|
# 使用shutil.move来移动目录 |
|
|
shutil.move(source_path, target_path) |
|
|
|
|
|
|
|
|
if os.path.exists(target_path): |
|
|
|
|
|
if os.path.isdir(target_path): |
|
|
|
|
|
shutil.rmtree(target_path) # 删除整个目录及其内容 |
|
|
|
|
|
else: |
|
|
|
|
|
os.remove(target_path) # 删除文件 |
|
|
|
|
|
shutil.move(source_path, target_path) |
|
|
print(f"Moved {directory} to {target_path}") |
|
|
print(f"Moved {directory} to {target_path}") |
|
|
else: |
|
|
else: |
|
|
print(f"Directory {directory} does not exist in the current directory.") |
|
|
print(f"Directory {directory} does not exist in the current directory.") |
|
|