2 ms·
> The shell script idea is neat. Could be something as simple as: file_path="${1}" mime="$(file --mime-type --brief "${file_path}")" ext="${mime#image/}
by latexr 2y ago
> The shell script idea is neat.
Could be something as simple as:
file_path="${1}"
mime="$(file --mime-type --brief "${file_path}")"
ext="${mime#image/}"
mv "${file_path}" "${file_path%.*}.${ext}"
That does no checks (e.g. is the file an image) and may not work on something on something like a video, but it’ll do for common image types such as png, jpeg, webp, heic, gif…