changes file-extension based on mime-type
Go to file
Dym Sohin 41ca3f1fb5 add .avif 2023-08-27 01:45:07 +02:00
LICENSE Initial commit 2023-06-20 17:18:53 +02:00
install.sh works on nixos 2023-08-06 22:47:24 +02:00
meta.kdl works on nixos 2023-08-06 22:47:24 +02:00
readme.md add .avif 2023-08-27 01:45:07 +02:00
rename-ext.sh add .avif 2023-08-27 01:45:07 +02:00

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

  1. look at install file for instructions
  2. adjust PREFIX at wish
  3. 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

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.