Batch create torrents, using mktorrent ctorrent and bash scripting

Alec Jacobson

March 01, 2010

weblog/

I been hunting for a long while for a simple way to batch create .torrent metainfo files for a list of files. What I want is one .torrent file for every .avi file say in the current directory. I found the handy tool, mktorrent ctorrent and with a little bash scripting one-liner came up with what I think is a decent solution for the command line:
for filename in *.avi; do \
ctorrent -t -u "[your announce url]" -s "$filename".torrent -p "$filename"; \
done
You may omit the -p if you don't want the torrent to be private. And you should replace *.avi with whatever files you are batch creating torrents for. Note: I began this post thinking I would be using createtorrent to generate the .torrent files but it seems that it doesn't have private tracker support...so I went with mktorrent Note: I had to edit this post to remove the mktorrent, too! It made bogus metainfo files that Transmission wouldn't verify against the real data... Augh. ctorrent has been working though.