diff --git a/projects/organized download folder with different categories/file-sortor.py b/projects/organized download folder with different categories/file-sortor.py index 9e7c07aa..1f0acfa2 100644 --- a/projects/organized download folder with different categories/file-sortor.py +++ b/projects/organized download folder with different categories/file-sortor.py @@ -1,15 +1,5 @@ import os import shutil -<<<<<<< HEAD - -os.chdir("E:\\downloads") -# print(os.getcwd()) - -# check number of files in directory -files = os.listdir() - -# list of extension (You can add more if you want) -======= os.chdir("E:\downloads") #print(os.getcwd()) @@ -17,23 +7,11 @@ files = os.listdir() #list of extension (You can add more if you want) ->>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42 extentions = { "images": [".jpg", ".png", ".jpeg", ".gif"], "videos": [".mp4", ".mkv"], "musics": [".mp3", ".wav"], "zip": [".zip", ".tgz", ".rar", ".tar"], -<<<<<<< HEAD - "documents": [".pdf", ".docx", ".csv", - ".xlsx", ".pptx", ".doc", ".ppt", ".xls"], - "setup": [".msi", ".exe"], - "programs": [".py", ".c", ".cpp", ".php", ".C", ".CPP"], - "design": [".xd", ".psd"], -} - - -# sort to specific folder depend on extenstions -======= "documents": [".pdf", ".docx", ".csv", ".xlsx", ".pptx", ".doc", ".ppt", ".xls"], "setup": [".msi", ".exe"], "programs": [".py", ".c", ".cpp", ".php", ".C", ".CPP"], @@ -44,7 +22,6 @@ #sort to specific folder depend on extenstions ->>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42 def sorting(file): keys = list(extentions.keys()) for key in keys: @@ -54,28 +31,17 @@ def sorting(file): return key -<<<<<<< HEAD -# iterate through each file -======= #iterat through each file ->>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42 for file in files: dist = sorting(file) if dist: try: shutil.move(file, "../download-sorting/" + dist) -<<<<<<< HEAD - except Exception: -======= except: ->>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42 print(file + " is already exist") else: try: shutil.move(file, "../download-sorting/others") -<<<<<<< HEAD - except Exception: -======= except: ->>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42 print(file + " is already exist") +