31 lines
937 B
Python
31 lines
937 B
Python
import os
|
|
import shutil
|
|
|
|
# 需要从 src/ 复制到根目录的文件夹
|
|
folders_to_copy = ['api', 'utils', 'config', 'mixins', 'store', 'components']
|
|
|
|
base_path = 'peidu/uniapp'
|
|
src_base = os.path.join(base_path, 'src')
|
|
|
|
copied_count = 0
|
|
|
|
for folder in folders_to_copy:
|
|
src_folder = os.path.join(src_base, folder)
|
|
dest_folder = os.path.join(base_path, folder)
|
|
|
|
if os.path.exists(src_folder):
|
|
# 确保目标文件夹存在
|
|
os.makedirs(dest_folder, exist_ok=True)
|
|
|
|
# 复制所有文件
|
|
for item in os.listdir(src_folder):
|
|
src_file = os.path.join(src_folder, item)
|
|
dest_file = os.path.join(dest_folder, item)
|
|
|
|
if os.path.isfile(src_file):
|
|
shutil.copy2(src_file, dest_file)
|
|
copied_count += 1
|
|
print(f"✓ 复制: {folder}/{item}")
|
|
|
|
print(f"\n✅ 总共复制了 {copied_count} 个文件")
|