Last active
March 7, 2022 01:05
-
-
Save gyakkun/931ab91290fcf58211694b7b9a90d6b3 to your computer and use it in GitHub Desktop.
Revisions
-
gyakkun revised this gist
Mar 7, 2022 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,14 @@ #!/bin/bash OLDIFS="$IFS" IFS=$'\n' PATH='/c/Program Files/Transmission':$PATH for i in $(ls \[U2\].*.torrent); do torrent_name=$(transmission-show $i | grep -Po "(?<=^Name: ).+$") echo "Torrent name: $torrent_name" torrent_id=$(echo $i | grep -Po "(?<=\.)\d+(?=\.torrent)") echo "Torrent ID: $torrent_id" new_name="[U2].$torrent_name.$torrent_id.torrent" echo "Original name: $i" echo "New name: $new_name" mv "$i" "$new_name" done -
gyakkun created this gist
Feb 26, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #!/bin/bash PATH='/c/Program Files/Transmission':$PATH for i in $(ls \[U2\].*.torrent); do torrent_name=$(transmission-show $i | grep -Po "(?<=^Name: ).+$") torrent_id=$(echo $i | grep -Po "(?<=\[U2\]\.)\d+") new_name="[U2].$torrent_name.$torrent_id.torrent" echo "Torrent name: $torrent_name" echo "Torrent ID: $torrent_id" echo "Original name: $i" echo "New name: $new_name" mv "$i" "$new_name" done