-
Notifications
You must be signed in to change notification settings - Fork 10
/
cfv.1
376 lines (376 loc) · 12.8 KB
/
cfv.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
.TH cfv 1 "05 Feb 2005"
.SH NAME
cfv \- Verify file consistency with .sfv, .csv, .crc, .md5, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, .torrent, par, or par2 files
.SH SYNOPSIS
.B cfv [\-p dir] [\-v|\-V|\-VV|\-q|\-Q] [\-\-progress VAL] [\-r|\-rr|\-R] [\-l|\-L] [\-n|\-N] [\-\-renameformat <s>] [\-s|\-S] [\-zz|\-z|\-Z|\-ZZ] [\-T|\-C] [\-m|\-M] [\-i|\-I] [\-u|\-uu|\-U] [\-\-encoding <e>] [\-\-unquote <b>] [\-\-fixpaths <s>] [\-\-strippaths <p>] [\-\-showpaths <i>] [\-\-list/\-\-list0 <l>] [\-\-announceurl <u>] [\-\-piece_size_pow2 <n>] [\-\-private_torrent] [\-t type] [\-f file] [files...]
.SH DESCRIPTION
.B cfv
verifies that the files you have are the same as those that the were used to create
the checksum file.
.SH OPTIONS
.PP
.IP "\-v"
Enable printing of extra messages.
.IP "\-V"
Disable printing of extra messages. (default)
.IP "\-VV"
Like \-V, but don't print status line at end either.
.IP "\-q"
Like \-VV, but not even error messages are printed. Check the exit status.
.IP "\-Q"
Only status lines are printed, but not individual errors.
.IP "\-\-progress VAL"
Set when cfv should display progress bars.
If no, progress bars are never displayed.
If auto, progress bars are displayed when the output is to a tty.(default)
If yes, progress is always displayed.
.IP "\-r"
Recursive mode 1. In create mode, make separate chksum files for each dir.
.IP "\-rr"
Recursive mode 2. In create mode make a single file with deep listing in it.
Both recursive modes are equivalent for test mode.
.IP "\-R"
Disable recursive mode (default)
.IP "\-l"
Follow directory symlinks in recursive mode. (default)
.IP "\-L"
Don't follow directory symlinks in recursive mode.
.IP "\-T"
Set test mode. (default)
.IP "\-C"
Set create mode.
.IP "\-m"
Check only for missing files (don't compare checksums)
.IP "\-M"
Check checksums (default)
.IP "\-n"
Rename bad files.
With \-s, also renames misnamed files to the correct name.
.IP "\-N"
Don't rename bad files (default)
.IP "\-\-renameformat string"
Format string to use with \-n option. Simply, put any of the 4 strings %(fullname)s, %(name)s, %(ext)s, and %(count)i in the format string, along with whatever other text you wish.
.br
The default is '%(name)s.bad\-%(count)i%(ext)s'
.br
In detail, this is a standard python format string with mapping that contains
{'fullname': original filename, 'name': fullname minus extension, 'ext': extension(including .), 'count': rename attempt}.
If the format string does not contain count, then cfv will append '\-%(count)i' to the filename if the first attempt fails.
.IP "\-s"
Search for misnamed files. No effect in create mode.
Also, keep in mind that using \-m together with \-s will do nothing if the checksum type doesn't include filesizes, and if it does, can give false positives if some files have the same size.
.IP "\-S"
Don't search for misnamed files. (default)
.IP "\-i"
Ignore case. Currently has no effect in create mode.
.IP "\-I"
Don't ignore case (default)
.IP "\-u"
Show unverified files.
If no files in a directory are verified, shows dir/*.
If no files in a directory or its subdirs are verified, shows dir/**.
Has no effect in create mode.
.IP "\-uu"
Show each unverified file individually, no special directory handling.
Has no effect in create mode.
.IP "\-U"
Don't show unverified files (default)
.IP "\-zz"
Force making/reading checksum files as gzipped files, even if not ending in .gz (mainly useful for "\-f \-")
.IP "\-z"
Make gzipped files in create mode.
.IP "\-Z"
Don't create gzipped files automatically. (default)
.IP "\-ZZ"
Never use gzip, even if file ends in ".gz".
.IP "\-\-encoding ENCODING"
Specify the encoding to use when reading/writing checksum files.
This can be any valid encoding name recognized by Python, or one of the following special values.
.RS
.IP "raw"
Read/write as raw byte streams.
May be useful for handling invalid filenames on disk or within a checksum file.
(For text based checksum file formats, this is how cfv versions prior to 2.0 behaved.)
.IP "auto"
The default.
For checksum file formats that specify their encoding explicitly, that value is used.
For text checksum file formats that start with a Unicode BOM (Byte Order Mark), the encoding is detected automatically.
Otherwise, Python's notion of the users preferred encoding is used.
.RE
.IP "\-\-unquote BOOL"
If yes, handle checksum files that were generated by buggy encoders that quote filenames in checksum formats that don't need it.
Default is no, since quotes can be a valid character in a filename and we don't want to remove them if they are actually part of the filename.
.IP "\-\-fixpaths string"
Convert all occurrences of any characters in string to the dir separator for the current platform. No effect in create mode. Use an empty string to disable.
.IP "\-\-strippaths VAL"
Strip NUM leading components from file names in test mode. Similar to the \-p/\-\-strip options of patch.
VAL may be 'none': leave exactly as is, 'all': strip everything but the filename, 0: strip the leading driveletter/slash (if any), 1+: strip this many path components in addition.
The default is 0.
.IP "\-\-showpaths VAL"
Show paths in displayed filenames.
VAL should be one of yes/1/no/0/auto/2 or absolute/relative, or one from first list and one from second joined by a \-.
For backwards compatibility, 1=yes, 0=none, 2=auto.
The default is auto\-relative.
Abrieviations are accepted.
Examples: \-\-showpaths=y\-a always shows absolute paths. \-\-showpaths=n never shows paths.
.IP "\-p dir"
Change to directory before doing anything.
.IP "\-f file"
Specify the name of the checksum file to test or create.
If file is \-, stdin (for \-T) or stdout (for \-C) will be used.
.IP "\-t type"
Specify the type of the file.
Can be sfv, sfvmd5, csv, csv2, csv4, sha1, sha224, sha256, sha384, sha512, md5, bsdmd5, par, par2, torrent, crc, auto, or help.
If the type is help, or an unknown type is given, a list of the types and their descriptions will be printed.
The default is auto, which will detect the file type for you.
When creating, if type is auto an sfv will be made, unless a different default has been set in the config file.
.IP "\-\-list listset"
Prints a raw listing of files in the given set (ok, bad, unverified, notfound). Usually used with \-q, but not strictly needed since specifying \-\-list will redirect all other messages to stderr.
.IP "\-\-list0 listset"
Like \-\-list but files are separated by a null char. Useful in combination with xargs \-0.
.IP "\-\-announceurl URL"
Tracker announce URL for .torrent file creation.
.IP "\-\-piece_size_pow2 N"
Power of two to set piece size to for .torrent file creation.
The default is 18, which gives a piece size of 2^18=256KB.
.IP "\-\-private_torrent"
Set private flag in torrent during .torrent file creation.
.IP "\-h/\-\-help"
Print help info.
.IP "\-\-version"
Print version of cfv and modules it uses.
.P
.B sfv
is a Simple File Verify format file
.br
.B sfvmd5
is a Simple File Verify format file, using MD5 checksums rather than crc32.
.br
.B csv
is a Comma Separated Value file, with the fields being name,size,crc32,
.br
.B csv2
is a Comma Separated Value file, with the fields being name,size,
.br
.B csv4
is a Comma Separated Value file, with the fields being name,size,crc32,path
.br
.B sha1
is a GNU sha1sum format file
.br
.B sha224
is a GNU sha224sum format file
.br
.B sha256
is a GNU sha256sum format file
.br
.B sha384
is a GNU sha384sum format file
.br
.B sha512
is a GNU sha512sum format file
.br
.B md5
is a GNU md5sum format file
.br
.B bsdmd5
is a BSD md5 format file
.br
.B par
is parchive v1 format file (test-only)
.br
.B par2
is parchive v2 format file (test-only)
.br
.B torrent
is a BitTorrent metainfo file
.br
.B crc
is a JPEG Sheriff format crc file
.SH EXIT STATUS
The exit status of cfv can be examined to determine what kind of errors, if any, occurred.
.P
An exit status of 1 indictates a command line argument error, or an unhandled exception.
.P
Otherwise, the exit status will be a bitwise OR of:
.IP 2
badcrc (a file had a different checksum than listed in the checksum file)
.IP 4
badsize (a file had a different size than listed. Not all checksum file formats include file size)
.IP 8
notfound (a file that was listed was not found)
.IP 16
ferror (some other file error occurred when trying to open/read a file)
.IP 32
unverified (a file was not verified, only with \-u)
.IP 64
cferror (a checksum file was not found or not recognized)
.SH NOTES
Since different platforms represent the path separator differently, using recursive mode 2 (\-rr) is not recommended for anything other than personal usage. Although the addition of the fixpaths option can be used to work around this, it isn't guaranteed that whatever program others user have will have a similar feature.
.P
The \-s option is not currently implemented for .torrent files. (Unless you also use \-m)
.SH EXAMPLES
If no options are specified, the default will be \-T \-t auto, and it will search the current directory for any supported checksum files.
.br
.B
cfv
.P
Force the file to test:
.br
.B
cfv \-f funny.name
.P
Test only the files you have, (avoid file not found errors):
.br
.B
cfv *
.P
Create a csv file for all the files in the current dir:
.br
.B
cfv \-C \-tcsv
.P
Create a csv file for only the zip files in the current dir, and specify the filename:
.br
.B
cfv \-C \-fsomezips.csv *.zip
.P
Check if all files in current and subdirs are verified, but don't verify checksums of files that are. (For example, before writing a directory to a cdr and you want to make sure all the files are verified.):
.br
.B
cfv \-r \-m \-u
.SH CONFIGURATION
Upon startup, cfv will test for ~/.cfvrc and if it exists, read configuration information from it.
The file consists of any number of lines, each having a single option name and the value separated by a space.
Empty lines and lines beginning with a # are ignored.
.SH EXAMPLE CONFIGURATION
#this is an example .cfvrc that specifies all the default options
.br
#don't be verbose (set to 1 or v for \-v, 0 or V for \-V, \-1 or VV for \-VV, \-2 or q for \-q, \-3 or Q for \-Q)
.br
verbose V
.br
#use progress meter when output is to a terminal (yes for always, no for never, auto for when output isatty)
.br
progress auto
.br
#create sfv files by default
.br
default sfv
.br
#sort dir listings before creating a checksum file
.br
dirsort 1
.br
#sort command line specified files
.br
cmdlinesort 1
.br
#expand wildcards in command line (yes for always, no for never, auto for when os.name is os2, nt, or dos)
.br
cmdlineglob auto
.br
#don't be recursive (set to 0 for \-R, 1 for \-r, 2 for \-rr)
.br
recursive 0
.br
#follow symbolic links
.br
dereference 1
.br
#don't show unverified files (set to 0 for \-U, 1 for \-u, 2 for \-uu)
.br
showunverified 0
.br
#don't ignore case
.br
ignorecase 0
.br
#don't use workaround for buggy encoders that quote filenames unnecessarily
.br
unquote 0
.br
#don't fix any paths (note that there is a single space after fixpaths, thus the value it gets set to is an empty string)
.br
fixpaths
.br
#A more useful example would be:
.br
#fixpaths /\\
.br
#don't strip leading directories (all to strip all path info, 0+ to strip the leading / and the first X components, none for nothing)
.br
strippaths 0
.br
#show full paths in recursive mode (set to 0 for never, 1 for always, 2 for only in recursive mode)
.br
showpaths 2
.br
#access checksum filenames that end with .gz as gzipped files (\-1 for never, 0 for with .gz, and 1 to make \-C make .gz files automatically)
.br
gzip 0
.br
#don't rename bad files
.br
rename 0
.br
#format to use for renaming bad files with \-n
.br
renameformat %(name)s.bad\-%(count)i%(ext)s
.br
#don't search for files
.br
search 0
.br
#filename_type can be used to override what type of file to create when \-t isn't specified.
.br
#The format of the argument is <typename>=<regex>. Can be specified multiple times, the earlier instances having higher priority.
.br
#for example, the following line would cause cfv \-C \-f foo.md5 to create a 'sfvmd5' file rather than a 'md5' file.
.br
#filename_type sfvmd5=md5$
.P
#torrent options:
.br
# you can specify a default announce url:
.br
#announceurl http://foo.bar/announce
.br
# piece size of 2^18 bytes (256KB):
.br
piece_size_pow2 18
.SH FILES
.PP
.IP "~/.cfvrc"
cfv configuration file. See configuration section.
.IP "~/_cfvrc"
alternate configuration file name.
(Since windows won't let you create files starting with a dot.)
.SH ENVIRONMENT
.PP
.IP "HOME"
Where to look for cfvrc file.
Note that win9x doesn't set this to anything automatically.
.IP "CFV_NOMMAP"
Set to a non-empty value to disable usage of mmap.
.SH AUTHOR
Matthew Mueller <donut AT dakotacom DOT net>
.br
David Lisa Gnedt <cfv-project AT davizone DOT at>
.P
The latest version can be found at:
.br
https://github.com/cfv-project/cfv
.P
The original project can be found at:
.br
http://cfv.sourceforge.net/
.SH "SEE ALSO"
.BR md5sum (1),
.BR sha1sum (1),
.BR sha224sum (1),
.BR sha256sum (1),
.BR sha384sum (1),
.BR sha512sum (1),
.BR md5 (1),
.BR xargs (1)