modified ExtensionName.py

master
piyx 4 years ago committed by piyx
parent 4ff6cc25df
commit cecaa94e1a

@ -6,9 +6,10 @@ def foldername(extension):
"exe" : "Software/Applications",
"txt" : "Notes/Text",
"pdf" : "PDFs",
"c" : "Code",
"py" : "Code",
"java": "Code",
"c" : "C programs",
"py" : "Python files",
"java": "Java programs",
"cpp" : "Cpp programs",
"jpg" : "Images",
"png" : "Images",
"jpeg": "Images",
@ -17,4 +18,4 @@ def foldername(extension):
"mp4" : "Videos",
"mkv" : "Videos",
}
return switcher.get(extension, "New Folder") #returns "New Folder" if not in dictionary
return switcher.get(extension, "Extras") #returns "New Folder" if not in dictionary

@ -22,6 +22,10 @@ def organizeFiles():
print(key)
path = paths[input("\nEnter the folder to be organized:")]
if (path == "C:/"):
print("Cannot make changes to system folder")
return 0
list_files = os.listdir(path)
list_extension_names = set([os.path.splitext(file)[1].strip(".") for file in list_files])
#os.path.splitext returns a tuple with file name and extension split
@ -47,14 +51,15 @@ def organizeFiles():
if not os.path.exists(path + folder_name + "/" + file):
shutil.move(path + file, path + folder_name + "/" + file)
print("Moved {} to {}".format(file, path + folder_name))
return 0
if(choice == 1):
organizeFiles()
elif(choice == 2):
pass
print("Backup feature not available yet")
elif(choice == 3):
pass
print("Feature to be added soon")
else:
print("\nInvalid Choice")

Loading…
Cancel
Save