File: dirconv.1

package info (click to toggle)
conv-tools 20160905-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 960 kB
  • sloc: sh: 1,350; ansic: 585; makefile: 24
file content (135 lines) | stat: -rw-r--r-- 4,235 bytes parent folder | download | duplicates (4)
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
.\"-
.\" Copyright (c) 2013-2014 The University of Oslo
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote
.\"    products derived from this software without specific prior written
.\"    permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd November 18, 2014
.Dt DIRCONV 1
.Sh NAME
.Nm dirconv
.Nd locate and transcode mixed-encoding file names
.Sh SYNOPSIS
.Nm
.Op Fl 078dFhnpruvw
.Op Fl f Ar charset
.Op Fl x Ar regex
.Op Ar path ...
.Sh DESCRIPTION
The
.Nm
utility recursively scans the specified path(s) and classifies files
and directories according to whether their names are pure 7-bit ASCII,
non-ASCII but valid UTF-8, double-UTF-8 (WTF-8), or neither.
.Pp
Names in the latter category are assumed to be Latin-1, unless a
different encoding is specified with the
.Fl f
option.
.Pp
By default, the
.Nm
utility then prints the names that are neither pure 7-bit ASCII nor
valid UTF-8.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl 0
Print a NUL character rather than a newline after each path.
This option has no effect if the
.Fl n
option was also specified.
.It Fl 7
Select names that are pure 7-bit ASCII.
.It Fl 8
Select names that contain non-ASCII characters but are not valid
UTF-8.
This is the default unless the
.Fl 7 ,
.Fl u
and / or
.Fl w
options are specified.
.It Fl d
Show debugging information.
This option can be specified multiple times to increase the level of
detail.
.It Fl F
In conjunction with the
.Fl r
option, force renaming a file when the target already exists.
.It Fl f Ar charset
Specify the assumed character set for non-ASCII, non-UTF-8 names.
The default is
.Dq iso8859-1 .
.It Fl h
Print a usage message and exit.
.It Fl n
In conjunction with the
.Fl r
option, show what would have happened, but do not actually rename any
files.
.It Fl p
Print the selected names.
.It Fl r
Attempt to convert the selected names to UTF-8 and rename the files
and directories.
.It Fl u
Select names which contain non-ASCII characters and are valid UTF-8
but not WTF-8.
.It Fl v
Print the source reversion number and exit.
.It Fl w
Select names which seem to be WTF-8-encoded.
.It Fl x Ar regex
Do not inspect files and directories whose unconverted names match the
specified POSIX extended regular expression.
.El
.Sh SEE ALSO
.Xr iconv 1 ,
.Xr regex 3 .
.Sh AUTHORS
The
.Nm
utility and this manual page were written by
.An Dag-Erling Sm\(/orgrav Aq des@des.no
for the University of Oslo.
.Sh NOTES
The
.Nm
utility works by attempting to decode each name as if it were a
sequence of UTF-8 characters.
It is possible, but highly unlikely, that a random string of
characters in a non-UTF single-byte encoding would look like a valid
UTF-8 sequence.
.Pp
Reliable detection of WTF-8 is only possible if the original 8-bit
encoding is known.
.Pp
The exclusion filter is applied
.Em before
name conversion.
Character classes are unlikely to work as expected on unconverted
names.