Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save syaifulsz/5c808f13c48d07d4fc9c9fc7066aeb65 to your computer and use it in GitHub Desktop.
Save syaifulsz/5c808f13c48d07d4fc9c9fc7066aeb65 to your computer and use it in GitHub Desktop.
rename_f()
{
local nameprefix="$1";
local fext="$2";
idx=0;
for f in *.$fext; do
((idx++));
idxstr=$(printf %02d $idx);
fnameneo="$nameprefix$idxstr.$fext";
echo -e "File Name Old : $f";
echo -e "File Name New : $fnameneo";
echo -e;
mv "$f" "$fnameneo";
done
}
# example usage
rename_f "Dexter New Blood " "mp4";
rename_f "Dexter New Blood " "srt";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment