On-the-fly Mode
Sometimes you just want to organize a single type of file without messing with your global config.json. forg handles this with On-the-fly Mode.
How it Works
When you provide both a --pattern (-p) and a --dest (-t) flag, forg bypasses your configuration file entirely and uses only the rule you provided on the command line.
# Move all PNG files from Downloads to ~/Documents/Images/PNGs
forg Downloads -p '.*\.png$' -t Documents/Images/PNGs
Requirements
- Both flags required: You cannot use
-pwithout-t, and vice versa. - Relative Target Dir: The
[TARGET_DIR](e.g.,Downloads) is relative to home. - Relative Destination: The destination (
-t) is also relative to home. - Single Quotes: Always wrap your regex pattern in single quotes
' 'to prevent your shell from interpreting special characters.
Use Cases
- Project Cleanup: Quickly move all
.logfiles to a logs folder. - Media Sorting: Isolate all
.mp4files into a specific movie folder. - Code Organization: Move all
.rsfiles to a source repository.
Dry Run First
Just like standard mode, On-the-fly mode supports --dry-run. It's highly recommended to use it to verify your one-off regex pattern!