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

Commit 86d853b

Browse files
authored
Merge pull request #18 from chavarera/master
Merge
2 parents 74ae4c4 + d3d15b7 commit 86d853b

File tree

1 file changed

+1
-35
lines changed
  • projects/organized download folder with different categories

1 file changed

+1
-35
lines changed
Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,17 @@
11
import os
22
import shutil
3-
<<<<<<< HEAD
4-
5-
os.chdir("E:\\downloads")
6-
# print(os.getcwd())
7-
8-
# check number of files in directory
9-
files = os.listdir()
10-
11-
# list of extension (You can add more if you want)
12-
=======
133
os.chdir("E:\downloads")
144
#print(os.getcwd())
155

166
#check number of files in directory
177
files = os.listdir()
188

199
#list of extension (You can add more if you want)
20-
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
2110
extentions = {
2211
"images": [".jpg", ".png", ".jpeg", ".gif"],
2312
"videos": [".mp4", ".mkv"],
2413
"musics": [".mp3", ".wav"],
2514
"zip": [".zip", ".tgz", ".rar", ".tar"],
26-
<<<<<<< HEAD
27-
"documents": [".pdf", ".docx", ".csv",
28-
".xlsx", ".pptx", ".doc", ".ppt", ".xls"],
29-
"setup": [".msi", ".exe"],
30-
"programs": [".py", ".c", ".cpp", ".php", ".C", ".CPP"],
31-
"design": [".xd", ".psd"],
32-
}
33-
34-
35-
# sort to specific folder depend on extenstions
36-
=======
3715
"documents": [".pdf", ".docx", ".csv", ".xlsx", ".pptx", ".doc", ".ppt", ".xls"],
3816
"setup": [".msi", ".exe"],
3917
"programs": [".py", ".c", ".cpp", ".php", ".C", ".CPP"],
@@ -44,7 +22,6 @@
4422

4523

4624
#sort to specific folder depend on extenstions
47-
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
4825
def sorting(file):
4926
keys = list(extentions.keys())
5027
for key in keys:
@@ -54,28 +31,17 @@ def sorting(file):
5431
return key
5532

5633

57-
<<<<<<< HEAD
58-
# iterate through each file
59-
=======
6034
#iterat through each file
61-
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
6235
for file in files:
6336
dist = sorting(file)
6437
if dist:
6538
try:
6639
shutil.move(file, "../download-sorting/" + dist)
67-
<<<<<<< HEAD
68-
except Exception:
69-
=======
7040
except:
71-
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
7241
print(file + " is already exist")
7342
else:
7443
try:
7544
shutil.move(file, "../download-sorting/others")
76-
<<<<<<< HEAD
77-
except Exception:
78-
=======
7945
except:
80-
>>>>>>> 760b764f0e43d93842442ba57e745ef195a27d42
8146
print(file + " is already exist")
47+

0 commit comments

Comments
 (0)