hangeol-chang_obsidian-csv-.../copy_to_obsidian.py

40 lines
1.1 KiB
Python
Raw Permalink Normal View History

2024-12-30 14:20:29 +00:00
import os
import shutil
# 경로 설정
2025-01-04 08:28:05 +00:00
SOURCE_FILES = {
'manifest.json' : 'manifest.json',
'main.js' : 'main.js',
'main.css' : 'styles.css',
}
2024-12-30 14:20:29 +00:00
OBSIDIAN_DIR = os.path.abspath('../obsidian/.obsidian')
2025-02-28 08:37:25 +00:00
TARGET_DIR = os.path.join(OBSIDIAN_DIR, 'plugins', 'CSV-allinone')
2024-12-30 14:20:29 +00:00
def copy_files():
# Obsidian 폴더 확인
if not os.path.exists(OBSIDIAN_DIR):
print(f"Error: Obsidian directory not found at {OBSIDIAN_DIR}")
return
2025-02-28 08:37:25 +00:00
# CSV-allinone 폴더가 없으면 생성
2024-12-30 14:20:29 +00:00
if not os.path.exists(TARGET_DIR):
print(f"Creating target directory: {TARGET_DIR}")
os.makedirs(TARGET_DIR, exist_ok=True)
# 파일 복사
2025-01-04 08:28:05 +00:00
for source_file, target_file in SOURCE_FILES.items():
source_path = os.path.abspath(source_file)
target_path = os.path.join(TARGET_DIR, target_file)
2024-12-30 14:20:29 +00:00
if os.path.exists(source_path):
shutil.copy2(source_path, target_path)
2025-01-04 08:28:05 +00:00
print(f"Copied {source_file} to {target_path}")
2024-12-30 14:20:29 +00:00
else:
print(f"Warning: Source file {source_path} not found.")
print("All files copied successfully!")
if __name__ == "__main__":
copy_files()