|
1 | | -torrentcheck - catalog a .torrent file and optionally verify content hashes |
2 | | -Usage: torrentcheck -t torrent-file [-p content-path] [-n] [-h] [-c] [-d] |
3 | | -Options: -n suppresses progress count, -h shows all hash values, |
4 | | - -c or -d uses comma or dot formatted byte counts. |
| 1 | +# torrentcheck |
| 2 | + |
| 3 | +torrentcheck - catalog a `.torrent` file and optionally verify content hashes. |
| 4 | + |
| 5 | +Usage: `torrentcheck torrent-file [-p content-path] [-n] [-h] [-c] [-d]` |
| 6 | + |
| 7 | +Options: |
| 8 | +`-n` suppresses progress count, |
| 9 | +`-h` shows all hash values, |
| 10 | +`-c` or `-d` uses comma or dot formatted byte counts. |
| 11 | + |
5 | 12 | Returns 0 if successful, nonzero return code if errors found. |
6 | 13 |
|
7 | | -Option: -sha1 [optional hash] acts as a simple SHA1 filter. |
8 | | -If -sha1 is followed by a hex hash, the return code will be zero |
| 14 | +Option: `-sha1` [optional hash] acts as a simple SHA1 filter. |
| 15 | + |
| 16 | +If `-sha1` is followed by a hex hash, the return code will be zero |
9 | 17 | on match and nonzero otherwise. |
10 | 18 |
|
11 | | -Summary |
12 | | -------- |
| 19 | +### Summary |
| 20 | + |
13 | 21 | This program is a command-line utility to catalog and verify torrent files. |
14 | 22 | Run with only the -t option, it displays the metadata, name, and size of |
15 | 23 | each file in the torrent. Run with the -t and -p options, it computes the |
@@ -38,44 +46,56 @@ file, and prints the SHA1 hash. If a SHA1 hash is provided on the command line, |
38 | 46 | it will return 0 if the hashes match or nonzero if they do not. This mode |
39 | 47 | should agree with the output of "openssl dgst -sha1" or "digest -a sha1" |
40 | 48 |
|
41 | | -Examples |
42 | | --------- |
43 | | -torrentcheck -t \torrents\ubuntu-10.10-desktop-i386.iso.torrent |
44 | | -torrentcheck -t \torrents\ubuntu-10.10-desktop-i386.iso.torrent -p \download |
45 | | -torrentcheck -t \torrents\ubuntu-10.10-desktop-i386.iso.torrent -p \download && echo good |
46 | | -torrentcheck -t \torrents\ubuntu-10.10-desktop-i386.iso.torrent -p \download || echo bad |
47 | | -torrentcheck -t \torrents\ubuntu-10.10-desktop-i386.iso.torrent -p \download\ubuntu-10.10-desktop-i386.iso |
| 49 | +### Examples |
| 50 | + |
| 51 | +```shell |
| 52 | +torrentcheck \torrents\ubuntu-10.10-desktop-i386.iso.torrent |
| 53 | +torrentcheck \torrents\ubuntu-10.10-desktop-i386.iso.torrent -p \download |
| 54 | +torrentcheck \torrents\ubuntu-10.10-desktop-i386.iso.torrent -p \download && echo good |
| 55 | +torrentcheck \torrents\ubuntu-10.10-desktop-i386.iso.torrent -p \download || echo bad |
| 56 | +torrentcheck \torrents\ubuntu-10.10-desktop-i386.iso.torrent -p \download\ubuntu-10.10-desktop-i386.iso |
48 | 57 | torrentcheck -sha1 < \download\ubuntu-10.10-desktop-i386.iso |
49 | 58 | torrentcheck -sha1 b28bbd742aff85d21b9ad96bb45b67c2d133be99 < \download\ubuntu-10.10-desktop-i386.iso && echo good |
| 59 | +``` |
50 | 60 | (These are for Windows; use forward slashes in Unix/Linux) |
51 | 61 |
|
52 | | -Automation and scripting |
53 | | ------------------------- |
| 62 | +### Automation and scripting |
| 63 | + |
54 | 64 | Torrentcheck returns 0 in the Unix $? return code or Windows errorlevel |
55 | 65 | if it successfully verifies a torrent, or nonzero return codes if it fails. |
56 | 66 |
|
57 | | -If you have your torrents in \torrents and the downloaded files in \share, |
58 | | -make a "bad" directory under \torrents, cd to \torrents, and run: |
| 67 | +If you have your torrents in `\torrents` and the downloaded files in `\share`, |
| 68 | +make a "bad" directory under `\torrents`, cd to `\torrents`, and run: |
59 | 69 |
|
60 | 70 | (Windows) |
61 | | -for %i in (*.torrent) do torrentcheck -t "%i" -p \share || move "%i" bad |
| 71 | +```shell |
| 72 | +for %i in (*.torrent) do torrentcheck "%i" -p \share || move "%i" bad |
| 73 | +``` |
| 74 | +
|
62 | 75 | (Linux) |
63 | | -for i in *.torrent; do torrentcheck -t "$i" -p /share || mv "$i" bad ; done |
| 76 | +```shell |
| 77 | +for i in *.torrent; do torrentcheck "$i" -p /share || mv "$i" bad ; done |
| 78 | +``` |
64 | 79 |
|
65 | 80 | This will check all the torrents, and move any that are not fully |
66 | | -downloaded and correct into \torrents\bad. |
| 81 | +downloaded and correct into `\torrents\bad`. |
67 | 82 |
|
68 | 83 | Run this command to generate a master list file with the contents of all your |
69 | 84 | torrents. This file can be searched to find a particular file and which torrent |
70 | 85 | it comes from. |
71 | 86 |
|
72 | 87 | (Windows) |
73 | | -for %i in (*.torrent) do torrentcheck -t "%i" >> masterlist.txt & echo. >> masterlist.txt |
| 88 | +```shell |
| 89 | +for %i in (*.torrent) do torrentcheck "%i" >> masterlist.txt & echo. >> masterlist.txt |
| 90 | +``` |
| 91 | +
|
74 | 92 | (Linux) |
75 | | -for i in *.torrent; do torrentcheck -t "$i" >> masterlist.txt ; echo >> masterlist.txt ; done |
| 93 | +```shell |
| 94 | +for i in *.torrent; do torrentcheck "$i" >> masterlist.txt ; echo >> masterlist.txt ; done |
| 95 | +``` |
| 96 | +
|
| 97 | +### Detailed description |
76 | 98 |
|
77 | | -Detailed description |
78 | | --------------------- |
79 | 99 | BitTorrent is a file sharing system which uses a metadata file, usually with |
80 | 100 | the .torrent extension, to identify a data file or group of files. Given the |
81 | 101 | metadata file, a BitTorrent client can download and share the data files. |
@@ -124,9 +144,9 @@ The SHA1 implementation used by torrentcheck was written by David Ireland, |
124 | 144 | AM Kuchling, and Peter Gutmann. The source code does not contain a copyright |
125 | 145 | notice, and this file is widely used on the Internet. |
126 | 146 |
|
127 | | -Compiling |
128 | | ---------- |
129 | | -There is no makefile. The required gcc lines are at the top of the |
130 | | -torrentcheck.c source file. The major catch in compiling is making 64-bit file |
| 147 | +### Compiling |
| 148 | +
|
| 149 | +There is no makefile. The required `gcc` lines are at the top of the |
| 150 | +`torrentcheck.c` source file. The major catch in compiling is making 64-bit file |
131 | 151 | I/O work. It is tested on Windows, Linux, and Solaris, but you may have to |
132 | 152 | experiment with compiler options to get 64-bit ftell and fseek working. |
0 commit comments