Skip to content

Commit fe214e7

Browse files
authored
Add files via upload
1 parent 13212b0 commit fe214e7

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
import shutil
3+
4+
#getting path of current folder/directory
5+
current_dir = os.path.dirname(os.path.realpath(__file__))
6+
7+
for filename in os.listdir(current_dir):
8+
#for images
9+
if filename.endswith(('.jpg', '.png', '.gif')):
10+
if not os.path.exists("Images"):
11+
os.makedirs('Images')
12+
shutil.copy(filename, 'Images')
13+
os.remove(filename)
14+
print('Images folder done')
15+
#for documents
16+
if filename.endswith(('.pdf', '.docx')):
17+
if not os.path.exists("Documents"):
18+
os.makedirs('Documents')
19+
shutil.copy(filename, 'Documents')
20+
os.remove(filename)
21+
print('Documents folder done')
22+
#for apps or softwares
23+
if filename.endswith(('.apk', '.exe')):
24+
if not os.path.exists("Apps"):
25+
os.makedirs('Apps')
26+
shutil.copy(filename, 'Apps')
27+
os.remove(filename)
28+
print('Apps folder done')
29+
#for videos
30+
if filename.endswith(('.mp4', '.wmv')):
31+
if not os.path.exists("Videos"):
32+
os.makedirs('Videos')
33+
shutil.copy(filename, 'Videos')
34+
os.remove(filename)
35+
print('Videos folder done')
36+
#after completing the task printing all done
37+
print('all done')

0 commit comments

Comments
 (0)