Dym Sohin 0f1e459836 | ||
---|---|---|
LICENSE | ||
install.sh | ||
meta.kdl | ||
readme.md | ||
rename-ext.sh |
readme.md
rename-ext
changes file-extension based on mime-type
also
- removes
*?|^:"<>
characters from the file-name - reducing multiple spaces, dots, and underscores
- adds rename-date suffix to ensure uniquness of the filename
- strips exec-flag from non-executive types (usual leftover from FAT/NTFS)
- optimizes images while at it (shows reduction size in
kb
and%
)
install
- look at install file for instructions
- adjust
PREFIX
at wish - make sure the final directory is on
$PATH
use
rename-ext /Data/Pictures/_unsorted/**/*
to only change extension and nothing else:
rename-ext --only-ext /Data/Photos/2020/*
to only print a report:
rename-ext --test-run /Data/Docs/_dump/*
requires
file
- to determine file typesd
– better sedjpegoptim
– to compress JPEGsimagemagick
orgraphicsmagic
– to mogrify PNGspngcrush
– to compress PNGs
todo
- find better determination tool for
application/octet-stream
- leverage
fd
to do recursive paralel execution if some of parameters are folders
q&a
Q: why not just rename files to hashes of their contents, and store original filenames in some database?
A: good point. that database is in my case a filesystem itself.