-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
38 lines (27 loc) · 945 Bytes
/
Copy pathsetup.py
File metadata and controls
38 lines (27 loc) · 945 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
32
33
34
35
36
37
38
from os import path, mkdir
from subprocess import run, PIPE, CalledProcessError
directories = ["Raw", "Done", ".In_progress"]
def check_prep(file_path):
dir_path = fr"{file_path}"
if not path.exists(dir_path):
mkdir(dir_path)
if file_path.startswith("."):
set_hidden_attribute(dir_path)
def set_hidden_attribute(folder_path):
try:
# Ensure folder_path is a valid string and handle backslashes
folder_path = folder_path.replace('\\', '\\\\')
# Construct the command
command = f'attrib +h "{folder_path}"'
# Execute the command
result = run(command, shell=True, check=True, text=True, stdout=PIPE, stderr=PIPE)
except CalledProcessError as e:
print(f"Error occurred: {e}")
print("Output:", e.stdout)
print("Error:", e.stderr)
for file_path in directories:
check_prep(file_path)
""""
SW: 2.0.32
IP: 172.28.21.119
"""