clean Command
Remove junk files, empty directories, and temporary files from a directory.
Basic Usage
# Clean directory recursively (default)
uv run para-files clean ~/Downloads
# Non-recursive
uv run para-files clean ~/Downloads --no-recursive
What Gets Cleaned
Apple temp files:
.DS_Store._*(AppleDouble shadow files).Spotlight-V100.Trashes.fseventsd
Windows temp files:
Thumbs.dbdesktop.ini$RECYCLE.BIN
Editor backup files:
*~(Vim/Emacs).swp(Vim swap).swo(Vim swap)
Empty directories: (removed bottom-up)
Options
--dry-run
Preview what would be deleted:
# Always do this first!
uv run para-files clean ~/Downloads --dry-run
--nfo
Also delete .nfo files (video metadata):
uv run para-files clean ~/Downloads --nfo
--no-empty-dirs
Skip empty directory cleanup:
# Only clean junk files, leave empty dirs
uv run para-files clean ~/Downloads --no-empty-dirs
--log PATH
Save cleanup log to JSON file:
uv run para-files clean ~/Downloads --log cleanup.json
# View what was deleted
cat cleanup.json
--json
Output as JSON:
uv run para-files clean ~/Downloads --json
-v, --verbose
Show detailed output:
uv run para-files clean ~/Downloads -v
Examples
Preview Before Cleaning
# Always preview first!
uv run para-files clean ~/Downloads --dry-run
# Review what would be deleted
Clean Downloads Folder
uv run para-files clean ~/Downloads
# Removes .DS_Store, Thumbs.db, and empty directories
Clean Recursively with Log
uv run para-files clean ~/Documents --log cleanup.json
# See what was cleaned
cat cleanup.json
Clean Without Touching Empty Directories
uv run para-files clean ~/Downloads --no-empty-dirs
# Removes junk files only
Include .nfo Files
uv run para-files clean ~/Videos --nfo
# Removes .nfo sidecar files (video metadata)
Safe Workflow
# 1. Always preview first
uv run para-files clean ~/Downloads --dry-run
# 2. Review output carefully
# 3. If satisfied, clean with a log
uv run para-files clean ~/Downloads --log cleanup.json
# 4. Check the log
cat cleanup.json
Troubleshooting
“Permission denied”? You may not have write permission in that directory.
“Nothing was cleaned”? The directory is already clean or doesn’t contain junk files.
Want to restore deleted files? Check your trash/recycle bin. clean permanently deletes.
Related Commands
- move - Move files after cleaning
- Task: Organize Directory - Full workflow