-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenfile.py
More file actions
31 lines (24 loc) · 973 Bytes
/
genfile.py
File metadata and controls
31 lines (24 loc) · 973 Bytes
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
import shutil
import os
def copy_lua_to_src():
source_dir = 'lua'
target_dir = 'src'
# Check if the source directory exists to avoid errors
if not os.path.exists(source_dir):
print(f"Error: The source directory '{source_dir}' does not exist.")
return
# Create the target directory if it doesn't already exist
if not os.path.exists(target_dir):
os.makedirs(target_dir)
print(f"Created target directory: {target_dir}")
# Iterate through all files in the source directory
for filename in os.listdir(source_dir):
source_path = os.path.join(source_dir, filename)
target_path = os.path.join(target_dir, filename)
# Ensure we are only copying files (not subfolders)
if os.path.isfile(source_path):
shutil.copy2(source_path, target_path)
print(f"Copied: {filename}")
print("\nFile transfer complete.")
if __name__ == "__main__":
copy_lua_to_src()