forked from melt-ui/melt-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmove_previews.py
More file actions
21 lines (19 loc) · 831 Bytes
/
move_previews.py
File metadata and controls
21 lines (19 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import shutil
# Define your root directory
root_dir = 'src/docs/previews'
# Walk through the root directory
for dir_path, dir_names, file_names in os.walk(root_dir):
for file_name in file_names:
# Check if the file is tailwind.svelte or css.svelte
if file_name in ['tailwind.svelte', 'css.svelte']:
# Create the new directory path
new_dir = os.path.join(dir_path, file_name.split('.')[0])
# Create the new directory
os.makedirs(new_dir, exist_ok=True)
# Create the new file path
new_file_path = os.path.join(new_dir, 'index.svelte')
# Create the old file path
old_file_path = os.path.join(dir_path, file_name)
# Move and rename the file
shutil.move(old_file_path, new_file_path)