Skip to content

Commit 22c9c1e

Browse files
Initial Commit
0 parents  commit 22c9c1e

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"[python]": {
3+
"editor.defaultFormatter": "ms-python.python"
4+
},
5+
"python.formatting.provider": "none"
6+
}

icon.ico

158 KB
Binary file not shown.

main.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import os
2+
import shutil
3+
4+
run = True
5+
directory = 'C:\\Users\\CodeCraft\\Downloads'
6+
PDF = 'C:\\Users\\CodeCraft\\Documents\\PDF'
7+
DOCX = 'C:\\Users\\CodeCraft\\Documents\\DOC'
8+
TORRENT = 'C:\\Users\\CodeCraft\\Downloads\\TORRENT'
9+
ZIP = 'D:\\Zip'
10+
Image = ['.png', '.jpg', '.jpeg', '.gif', '.tiff', '.psd', '.raw', '.bmp', '.heif', '.indd', '.svg', '.ai', '.eps', '.pdf', '.ico', '.webp']
11+
IMAGE = 'C:\\Users\\CodeCraft\\Pictures\\Photos'
12+
PYTHON = 'D:\\Python'
13+
VIDEO = 'C:\\Users\\CodeCraft\\Videos'
14+
MUSIC = 'C:\\Users\\CodeCraft\\Music'
15+
Video = ['.mp4', '.mov', '.wmv', '.avi', '.avchd', '.flv', '.f4v', '.swf', '.mkv', '.webm', '.mng', '.gifv', '.mpg', '.mp2', '.mpeg', '.mpe', '.mpv', '.ogg', '.m4p', '.m4v', '.wmv', '.mov', '.qt', '.flv', '.swf', '.avchd']
16+
audio_formats = ('.mp3', '.wav', '.aiff', '.flac', '.aac', '.ogg', '.wma', '.m4a', '.ape', '.alac', '.dsd')
17+
def move_the_file_to_right_place(main_directory, move_folder, filename):
18+
if not os.path.exists(move_folder):
19+
os.makedirs(move_folder)
20+
shutil.move(os.path.join(main_directory, filename), os.path.join(move_folder, filename))
21+
22+
def check_file_extension(file_ext, dir, mov_dir, filename):
23+
if filename.endswith(file_ext):
24+
move_the_file_to_right_place(main_directory=dir, move_folder=mov_dir, filename=filename)
25+
26+
try:
27+
print('Program started.')
28+
print('Please press Crtl C to close the app.')
29+
while run:
30+
for filename in os.listdir(directory):
31+
check_file_extension(".pdf", dir=directory, mov_dir=PDF, filename=filename)
32+
check_file_extension(".docx", dir=directory, mov_dir=DOCX, filename=filename)
33+
check_file_extension('.zip', dir=directory, mov_dir=ZIP, filename=filename)
34+
check_file_extension(tuple(Image), dir=directory, mov_dir=IMAGE, filename=filename)
35+
check_file_extension('.py', dir=directory, mov_dir=PYTHON, filename=filename)
36+
check_file_extension(tuple(Video), dir=directory, mov_dir=VIDEO, filename=filename)
37+
check_file_extension(tuple(audio_formats), dir=directory, mov_dir=MUSIC, filename=filename)
38+
check_file_extension('.torrent', dir=directory, mov_dir=TORRENT, filename=filename)
39+
except KeyboardInterrupt:
40+
print('Closing the app.')
41+
# Do some stuff here, such as saving data or cleaning up resources.

setup.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from cx_Freeze import setup, Executable
2+
3+
# Dependencies are automatically detected, but it might need
4+
# fine tuning.
5+
build_options = {'packages': [], 'excludes': [],'build_exe': 'build_windows'}
6+
7+
base = 'console'
8+
9+
executables = [
10+
Executable('main.py', base=base, target_name = 'Auto-Download-Cleanup',uac_admin=True,icon='icon.ico')
11+
]
12+
13+
setup(name='Auto-Download-Cleanup',
14+
version = '1.0',
15+
description = 'Automatic sorter for downloads folder',
16+
options = {'build_exe': build_options},
17+
executables = executables)

0 commit comments

Comments
 (0)