a
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import shutil
|
||||
|
||||
# 清理旧目录
|
||||
target_dir = "/home/ubuntu/nanocode/it_automation"
|
||||
if os.path.exists(target_dir):
|
||||
# 只删除空目录
|
||||
try:
|
||||
os.rmdir(target_dir)
|
||||
print(f"已删除空目录: {target_dir}")
|
||||
except OSError:
|
||||
print(f"目录非空,跳过删除: {target_dir}")
|
||||
|
||||
# 创建新目录结构
|
||||
os.makedirs(os.path.join(target_dir, "scripts"), exist_ok=True)
|
||||
os.makedirs(os.path.join(target_dir, "config_templates"), exist_ok=True)
|
||||
os.makedirs(os.path.join(target_dir, "docs"), exist_ok=True)
|
||||
|
||||
print("目录结构创建成功:")
|
||||
for root, dirs, files in os.walk(target_dir):
|
||||
level = root.replace(target_dir, '').count(os.sep)
|
||||
indent = ' ' * 2 * level
|
||||
print(f'{indent}{os.path.basename(root)}/')
|
||||
subindent = ' ' * 2 * (level + 1)
|
||||
for file in files:
|
||||
print(f'{subindent}{file}')
|
||||
Reference in New Issue
Block a user