Skip to content

Instantly share code, notes, and snippets.

@denniskupec
Last active November 10, 2017 23:20
Show Gist options
  • Save denniskupec/a3887f00643d59d73de8fcb0a76f4e00 to your computer and use it in GitHub Desktop.
Save denniskupec/a3887f00643d59d73de8fcb0a76f4e00 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
[ -z $1 ] && exit 1;
for f in *.$1;
do
# https://github.com/denniskupec/sfv
c=$(sfv "$f") && echo "$c --> $f"
mv "$f" "${f%.*} [$c].${f##*.}"
done
exit 0
#!/usr/bin/env bash
function batch-sfv () {
[ -z $1 ] && return 1;
for f in *.$1; do
mv -v "$f" "${f%.*} [$($(which sfv) "$f")].${f##*.}"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment