Responsive image
Date 2021-08-18 02:00

I love mirroring Linux distributions via bittorrent from a seedbox. When Debian 11 came out I wanted to make sure I was mirroring all those bittorrents.

Previously I was manually going through cdimage on trying to find all the *.torrent in a browser.

Eventually, I thought there had to be a better way. So, I found one!

Basically, here is what I did:

$ mkdir ~/downloads/debian_rsync
$ mkdir ~/downloads/debian_bittorrents
$ rsync -ravm --progress --include="*-11.0*.torrent" --include="*/" --exclude="*" rsync:// ~/downloads/debian_rsync
$ cd ~/downloads/debian_rsync
$ shopt -s globstar
$ mv **/*.torrent ~/downloads/debian_bittorrents

Then for the unofficial mirror:

$ mkdir ~/downloads/debian_rsync2
$ rsync -ravm --progress --include="*-11.0*.torrent" --include="*/" --exclude="*" rsync:// ~/downloads/debian_rsync2
$ cd ~/downloads/debian_rsync2
$ mv -i **/*.torrent ~/downloads/debian_bittorrents

Now ~/downloads/debian_bittorrents will have all the Debian 11 bittorrents from

One of the tricks to make this work so you don't end up with so many useless folders is the -m option on rsync. This option only creates local folder that contain files that match the pattern you are looking for.

Other things I tried was searching for rsync flags that would ignore the directory structure upon copying, or flatten the output of rsync. Most of these solutions require local access to the files you are trying to copy and wouldn't have worked for this puzzle.


comments powered by Disqus

where randomness meets the internet

~ About me ~
just a human doing random things
~ Follow me ~
~ GitHub Recent Activity ~

Status updating...

@myano on GitHub