This Python script automatically organizes files in a specified source directory by moving them into categorized folders based on their file types (audio, video, images, documents).
- The script scans a source directory for files (e.g. your desktop).
- Each file's extension is checked against predefined categories:
- Audio (e.g.,
.mp3,.wav,.flac) - Video (e.g.,
.mp4,.avi,.mov) - Image (e.g.,
.jpg,.png,.gif) - Document (e.g.,
.pdf,.docx,.xls)
- Audio (e.g.,
- Files are moved to their corresponding destination folders:
- Audio files → Music folder
- Video files → Videos folder
- Image files → Pictures folder
- Document files → Documents folder
- If a file with the same name already exists in the destination, the script renames the new file by appending a number to avoid overwriting.
-
Clone the repository
git clone https://github.com/NikolasChorianopoulos/Desktop-file-manager
-
Change the
source_dirvariable to the directory you want to clean. -
Adjust the destination directories (
dest_dir_audio,dest_dir_video, etc.) to your preferred folders. -
Modify or extend the lists of file extensions if needed.
Go to where you cloned the repo and simply run the script. It will process all files in the source directory and move them accordingly.
python3 Desktop_file_manager.pyThe script outputs info messages to the console showing which files have been moved and where.
- Python 3.x
- Standard Python libraries:
osloggingshutil
No additional packages need to be installed.