Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Merge #18

Merged
merged 5 commits into from
Jun 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,39 +1,17 @@
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())

#check number of files in directory
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"],
Expand All @@ -44,7 +22,6 @@


#sort to specific folder depend on extenstions
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
def sorting(file):
keys = list(extentions.keys())
for key in keys:
Expand All @@ -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")