47

I'm using mktorrent, but I'm having problems with it since it doesn't hash the files in the directory for some weird reason...

I'm looking for a replacement specifically for command line

allenskd
  • 1,288

5 Answers5

42

How about ctorrent?

sudo apt-get install ctorrent
ctorrent -t -u "http://tracker.example.com:6969/announce" -s example.torrent file_or_dir_to_upload 

It's also a very good client.

johnsyweb
  • 658
34

Transmission can do it:

$ ./transmission-create --help
Usage: transmission-create [options] <file|directory>

Options:

 -h --help              Display this help page and exit
 -p --private           Allow this torrent to only be used with the specified tracker(s)
 -o --outfile <file>    Save the generated .torrent to this filename
 -c --comment <comment> Add a comment
 -t --tracker <url>     Add a tracker's announce URL
 -V --version           Show version number and exit

an example could be:

transmission-create -o /var/lib/transmission-daemon/downloads/files.torrent -c "My comments" -t udp://tracker.openbittorrent.com:80 ~/torrent/complete/my_file_or_directory_to_share.extension

you can find more documentation here

user13029
  • 451
3

py3createtorrent

Description:

Create torrents via command line!

py3createtorrent is a comprehensive shell/commandline utility for creating torrents (Linux & Windows). It's a GPL-licensed Python v3.1 script.

robert
  • 138
  • 4
3

Buildtorrent

sudo apt-get install buildtorrent

From synaptic:

Description: command line torrent creation program

buildtorrent is a torrent file creation program. Given an announce url and an input file or directory, buildtorrent generates an output .torrent file that can be used by torrent clients.

sagarchalise
  • 24,306
0

You can use torrenttools.

sudo add-apt-repository ppa:fbdtemme/torrenttools
sudo apt-get update
sudo apt install torrenttools
Create BitTorrent metafiles.
Usage: torrenttools create [OPTIONS] target

Positionals: target <path> Target filename or directory

Options: -h,--help Print this help message and exit -v,--protocol <protocol> Set the bittorrent protocol to use. Options are 1, 2 or hybrid. [default: 1] -o,--output <path> Set the filename and/or output directory of the created file. [default: <name>.torrent] Use a path with trailing slash to only set the output directory. -a,--announce <url>... Add one or multiple announces urls. Multiple trackers will be added in seperate tiers by default. Use square brackets to groups urls in a single tier: eg. "--announce url1 [url1 url2]" -g,--announce-group <name>... Add the announce-urls defined from an announce group specified in the configuration file. Multiple groups can be passed. eg. "--announce-group group1 group2" -w,--web-seed <url>... Add one or multiple HTTP/FTP urls as seeds. -d,--dht-node <host:port>... Add one or multiple DHT nodes. -c,--comment <string> Add a comment. -p,--private <[on|off]> Set the private flag to disable DHT and PEX. -l,--piece-size <size[K|M]> Set the piece size. When no unit is specified block size will be either 2^<n> bytes, or <n> bytes if n is larger or equal to 16384. Piece size must be a power of two in range [16K, 64M]. Leave empty or set to auto to determine by total file size. [default: auto] -s,--source <source> Add a source tag to facilitate cross-seeding. -n,--name <name> Set the name of the torrent. This changes the filename for single file torrents or the root directory name for multi-file torrents. [default: <basename of target>] -t,--threads <n> Set the number of threads to use for hashing pieces. [default: 2] --checksum <algorithm>... Include a per file checksum of given algorithm. --no-creation-date Do not include the creation date. --creation-date <ISO-8601|POSIX time> Override the value of the creation date field as ISO-8601 time or POSIX time. eg.: "2021-01-22T18:21:46+0100" --no-created-by Do not include the name and version of this program. --created-by <string> Override the value of the created by field. --include <regex>... Only add files matching given regex to the metafile. --exclude <regex>... Do not add files matching given regex to the metafile. --include-hidden Do not skip hidden files. --io-block-size <size[K|M]> The size of blocks read from storage. Must be larger or equal to the piece size.

Disclaimer: I am the author of this tool.

See the documentation for more information and examples.