-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
move.py
36 lines (27 loc) · 1.09 KB
/
move.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import shutil
def move_files(lang):
# Define source and destination directories
month = '2023/07'
source_dir = f'i18n/{lang}/docusaurus-plugin-content-docs/current/{month}'
dest_dir = f'archive/{lang}/{month}'
# Check if the source directory exists
if not os.path.exists(source_dir):
print(f"Source directory {source_dir} does not exist. Skipping.")
return
# Create the destination directory if it doesn't exist
os.makedirs(dest_dir, exist_ok=True)
# List all files in the source directory
files = os.listdir(source_dir)
# Move each file from the source to the destination directory
for file in files:
shutil.move(os.path.join(source_dir, file), os.path.join(dest_dir, file))
print(f"Moved file {file} to {dest_dir}")
locales = [
'ar', 'bn', 'cs', 'da', 'de', 'el', 'es', 'fi', 'fr', 'he', 'hi', 'hu',
'id', 'it', 'ja', 'ko', 'nl', 'nb', 'pl', 'pt', 'ro', 'ru', 'sk', 'sv', 'ta',
'th', 'tr', 'zh-Hans', 'zh-Hant',
]
# Running the function for each locale
for locale in locales:
move_files(locale)