-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
26 lines (24 loc) · 753 Bytes
/
main.py
File metadata and controls
26 lines (24 loc) · 753 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
import logging
from functions import *
dir = ""
while len(dir) <1:
dir = input("Chemin du dossier à réordonner : ")
if len(dir) < 1:
print("Saisie incorrect ")
DOSSIER = Path(dir)
allFIles = all_files_dirs(DOSSIER)
if len(allFIles) < 1:
print("Sans Contenu")
else:
logging.basicConfig(filename= Path(DOSSIER/'Moving-process.log'),
filemode = 'w',
level=logging.INFO,
encoding='utf-8')
for file in allFIles:
destination = finalDir(file, DOSSIER)
try:
move(file, destination)
logging.info(f"Fichier {file.name} déplacé vers {destination}")
except PermissionError:
print(file.name)
pass