Skip to content

Instantly share code, notes, and snippets.

@gyakkun
Created September 10, 2018 02:14
Show Gist options
  • Save gyakkun/f4a4f49a6df7983e28978cd311cb546c to your computer and use it in GitHub Desktop.
Save gyakkun/f4a4f49a6df7983e28978cd311cb546c to your computer and use it in GitHub Desktop.
Rename some torrent files in my convention.
#!/bin/bash
for i in $(ls *.torrent); do
new_filename=`transmission-show $i | grep -Po "(?<=^Name: ).+$"`
rename -v "s/(?<=\[U2\]\.)(?=(\d+))/$new_filename\./" $i
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment