Usefull tools for filesystem structuring
This script organizes files by copying or moving them from a source directory to a destination directory, based on specified file extensions. Additionally, it can clean up empty folders if files are moved.
- Supports copying (default) or moving files.
- Allows filtering files by extensions.
- Provides an option to overwrite existing files in the destination.
- Automatically removes empty folders after moving files.
- Works recursively through subdirectories.
python script.py <source_directory> <destination_directory> [OPTIONS]| Argument | Description |
|---|---|
source |
Source directory to search for files. |
destination |
Destination directory to store files. |
--extensions |
Space-separated list of file extensions to filter (default: .pdf .xml .jpg .tif .png .txt .md .json). |
--overwrite |
Enables overwriting files in the destination directory. |
--move |
Moves files instead of copying them. |
python script.py /path/to/source /path/to/destinationpython script.py /path/to/source /path/to/destination --movepython script.py /path/to/source /path/to/destination --extensions .txt .pdfpython script.py /path/to/source /path/to/destination --move --overwrite- Python 3.x
- Clone or download the script.
- Ensure you have Python installed (
python --version). - Run the script using the command-line examples above.
- If
--moveis used, empty directories in the source folder will be deleted. - Ensure you have the correct permissions to access source and destination directories.
MIT License