Last active
December 29, 2018 10:37
-
-
Save 1gg/502a4428461b37c7c025951f743cbb74 to your computer and use it in GitHub Desktop.
rename single tracker torrent file by its tracker and folder name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir renamed | |
for file in $PWD/*.torrent; do | |
# echo $file | |
#transmission-show $file>> ti.txt | |
name=$(transmission-show $file|grep ' Name'| grep -Po '.*Name: \K.*') | |
#echo $name | |
tracker=$(transmission-show $file |grep -v Comment |grep 'http'| grep -Po '\/\/(.*?)\/'| grep -Po '[^\/]+(?=\/)') | |
# echo $tracker | |
tracker="${tracker} - " | |
filename=$tracker$name".torrent" | |
echo $filename | |
# echo $PWD/renamed/$filename | |
cp $file "${PWD}/renamed/${filename}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment