You are not logged in.
Hello, I've a machine with an old version of transmission (2.92), and I've thousands torrents in different locations/paths. I need to backup all .torrent files and real file positions before I perform a new Archlinux installation, in order to not manually add each torrent in transmission. What is the best way to perform the backup?
I can backup torrent files from /.config/transmission/torrents and then I just need a list like this:
/path/of/source_file1.iso source_file1.torrent
/another_path/of/source_file2.iso source_file2.torrent
/path/of/source_file3.iso source_file3.torrent
Last edited by pepper (2021-08-31 07:28:53)
Offline
If you don't mind using Perl... Depends on how many [topdir] do you have, this bash/perl function will traverse all sub-directries and print filepath and filename pairs.
backup.torrent ()
{
local dir=${1:?[directory]};
[[ -d $dir ]] || return 1;
/usr/sbin/perl - "${dir}" <<'BACKUPTORRENT'
use v5.34.0;
use warnings;
use File::Find;
my @Files;
my ($dir) = @ARGV;
my ($source) = ("");
sub insert
{
return if(! -e || -z || -d || -l || ! -R);
@_ = split(/\./,$_);
$_[-1] = 'torrent';
$source = "$File::Find::name";
$source =~ s;\';'\\'';g;
$source =~ s;\";'\\'";g;
$source = "'" . $source . " \"" . join(".",@_) . "\"'\n";
push @Files,"$source ";
}
find(\&insert,$dir);
print "@Files";
BACKUPTORRENT
}
# backup.torrent /topdir1/
# backup.torrent /topdir2/
# ... Last edited by solskog (2021-09-01 10:20:10)
Offline