A simple CLI tool to correct file extensions to match their file signatures.
kti scans recursively through directories and finds files that have file extensions that do not match their file signature.
Kti fully supports the following file extensions:
- flac
- gif
- jpg
- mkv
- mp3
- ogg
- png
- wav
- webp
These 3 may not be always recognized:
- mp4
- opus (falls back to ogg)
- webm (falls back to mkv)
You first need a working installation of the Rust compiler. Simply visit rustup and follow the steps for the operating system you are using. After you are done and have a working version of rust, you can run this command:
cargo install --git https://github.com/MotherStarry/ktiDo make sure to add .cargo/bin to your path.
I strongly recommend you first read through the couple options kti has available, to do so just type kti -h or kti --help in your terminal.
You can generate completions for your shell by using the --generate-completions option and adding the shell you wish to generate completions for piped to the path used by your shell for completions. Fish shell for example:
kti --generate-completions fish > ~/.config/fish/completions/kti.fishImportant: By default kti will change all file extensions for the files that do not match with what kti has found. I advise you first run kti with the --dry-run option and verifying the changes kti plans to make before running kti without it. Example:
kti -d --dry-runThis command will show you what files kti would change.
If you only want to use kti on a single file you can do so with:
kti your_file.pngif you just want to recursively correct all files in the directory you are in its as simple as:
ktirunning this will not add any color to the output and will print out all files whether they have different extensions or not and it will also skip hidden files.
if you wish to silence kti you can add the -s option like here:
kti -sI suggest using kti with the -d option and -c for prettier and likely more readable output or if you wish to limit your search depth you can use the -m option.