Project details
tmv is a versatile file sorting utility designed to streamline file organization in Bash. Whether sorting on demand or automatically at set intervals, tmv sorts files into specified folders using custom patterns. Its easy installation and user-friendly execution make it ideal for those seeking to enhance their file management process.
tmv is a powerful file sorting utility crafted entirely in Bash, designed to help automate the organization of files into designated folders based on customizable presets or glob patterns. This tool operates seamlessly via command line input or can be scheduled for automatic sorting through a systemd user timer, providing both flexibility and ease of use for file management.
Two Operating Modes: Use tmv interactively from the command line with pairs of <selector> <folder> arguments, or set it to run automatically at defined intervals with the help of systemd timers.
Core Functionality: The utility relies on the tmv_move_matching <dir> <selector> <dest_name> function, ensuring consistent sorting logic regardless of the method of operation.
Safety Measures: tmv is designed to protect files during the sorting process. It never overwrites existing files by appending numeric suffixes to avoid name collisions, and it only processes files directly within the target directory.
User-Friendly Configuration: Users can define their sorting rules easily through an environment file (tmv.env). The rules are validated prior to execution, maintaining safety and functionality.
Upon installation, tmv sets up a structured environment with all necessary files located in ~/.local/share/tmv/, including scripts and systemd service files for timer operations. This setup does not require root access, promoting a user-specific installation approach.
tmv/
├── install.sh # Installer script for setup
├── bin/
│ └── tmv # Main executable with argument parsing
├── lib/
│ ├── presets.sh # Mapping of presets to file extensions
│ ├── sorter.sh # Core sorting logic
│ └── validate.sh # Validator for environment file
├── systemd/
│ ├── tmv.service # Service unit for manual sorting
│ └── tmv.timer # Timer for scheduled sorting
├── examples/
│ └── tmv.env # Example rules file
├── tests/
│ └── run.sh # Manual testing script
└── DESIGN.md # Document outlining design decisions and roadmap
$ tmv --video-files Videos
$ tmv -n --images-files Pictures
# Define your environment file
TARGET_DIR="$HOME/Downloads"
TARGET_FILES="--video-files"
DIR_NAME="Videos"
Users can manage the timer with commands to list next runs, force immediate sorts, or adjust the timer’s frequency. The default interval is set for every 15 minutes, but can be modified to suit user needs easily.
Through systematic organization of file types and configuring automated tasks, tmv cultivates a more organized digital workspace, enabling users to enhance productivity by minimizing manual sorting efforts.
Comments
0Start the conversation
Share the first comment.