Skip to content

Instantly share code, notes, and snippets.

@mdzidic
Last active July 17, 2019 14:20
Show Gist options
  • Save mdzidic/f752dcc232e91c641e7731ee49e2f440 to your computer and use it in GitHub Desktop.
Save mdzidic/f752dcc232e91c641e7731ee49e2f440 to your computer and use it in GitHub Desktop.
Batch file extension rename based on fidentify output
#!/bin/bash
$fileExtension="eCryptfs"
for f in *.$fileExtension; do
newExtension=$(fidentify $f | awk '{print $2}')
mv -- "$f" "${f%.eCryptfs}.$newExtension"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment