Initial commit

This commit is contained in:
Juul
2026-04-17 16:01:09 +02:00
commit bf23d2f0cc
6 changed files with 218 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
from tkinter.filedialog import askdirectory
from tkinter import Tk
from pathlib import Path
import os
# We don't want the GUI window of
# tkinter to be appearing on our screen
Tk().withdraw()
# Dialog box for selecting a folder.
file_path = askdirectory(title="Select your folder")
# Listing out all the files
# inside our root folder.
list_of_files = os.walk(file_path)
def moveFile(root, file):
if root != file_path:
old_file = Path(os.path.join(str(root), file))
new_file = Path(os.path.join(file_path, file))
print("Moving " + file)
os.rename(old_file, new_file)
def main():
for root, folders, files in list_of_files:
for file in files:
moveFile(root, file)
input()
main()