Skip to content

Instantly share code, notes, and snippets.

@jxu
Last active January 28, 2020 08:26
Show Gist options
  • Save jxu/aac2a9d01f7bd0779af448e0daa7b2d6 to your computer and use it in GitHub Desktop.
Save jxu/aac2a9d01f7bd0779af448e0daa7b2d6 to your computer and use it in GitHub Desktop.
rename videos based on youtube-dl JSON info
for f in *.json
do
pi=$(jq .playlist_index < "$f")
pi=$(printf %03d $pi)
d=$(jq -r .upload_date < "$f")
b=$(basename "$f" .info.json)
for ff in "$b"*
do
mv -v "$ff" "$pi $d $ff"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment