DIRCONV(1)

πŸ’– DIRCONV(1) β€” the dirconv page, but make it cute πŸ’–

okay bestie, welcome to dirconv(1), the manual page for a lil utility called dirconv that goes hunting for weirdly-encoded file names and then fixes them for you. it's giving detective but for character encodings. πŸ•΅οΈβ™€οΈβœ¨


🌸 NAME 🌸

dirconv β€” locate and transcode mixed-encoding file names πŸ’…


✨ SYNOPSIS ✨

dirconv [-078dFhnpruvw] [-f charset] [-x regex] [path ...]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the vibe. the dirconv utility recursively scans the path(s) you gave it and sorts every file and directory by what its name looks like:

  • pure 7-bit ASCII πŸ’―
  • not ASCII, but valid UTF-8 🌈
  • double-UTF-8 (WTF-8) 😭
  • none of the above πŸ™ˆ

names in that last category? we just assume they're Latin-1, unless you told us a different encoding with the -f option.

and then, by default, dirconv prints out the names that are neither pure 7-bit ASCII nor valid UTF-8. that's it. that's the default behavior. no cap.

the following options are available:

  • -0 β€” print a NUL character instead of a newline after each path. heads up tho: this option does nothing if you also used -n. βœ‹
  • -7 β€” select names that are pure 7-bit ASCII. πŸ’―
  • -8 β€” select names that contain non-ASCII characters but are not valid UTF-8. this is the default unless you specified -7, -u and / or -w. πŸ‘€
  • -d β€” show debugging info. you can stack this option multiple times to crank up the level of detail. πŸ“ˆ
  • -F β€” paired with -r, force renaming a file when the target already exists. no fear. πŸ”₯
  • -f charset β€” specify the assumed character set for non-ASCII, non-UTF-8 names. the default is β€œiso8859-1”. 🌍
  • -h β€” print a usage message and exit. classic. πŸ‘‹
  • -n β€” paired with -r, show what would have happened, but don't actually rename any files. it's a dress rehearsal bestie, nothing gets touched. πŸ™ˆ
  • -p β€” print the selected names. πŸ–¨οΈ
  • -r β€” attempt to convert the selected names to UTF-8 and rename the files and directories. the main character option. πŸ‘‘
  • -u β€” select names which contain non-ASCII characters and are valid UTF-8 but not WTF-8. 🌈
  • -v β€” print the source reversion number and exit. ℹ️
  • -w β€” select names which seem to be WTF-8-encoded. 😭
  • -x regex β€” do not inspect files and directories whose unconverted names match the specified POSIX extended regular expression. 🚫

πŸ’œ SEE ALSO πŸ’œ

iconv(1), regex(3).


πŸŽ€ AUTHORS πŸŽ€

the dirconv utility and this manual page were written by Dag-Erling Smørgrav <des@des.no> for the University of Oslo. absolute icons, honestly. 🫢


⭐ NOTES ⭐

okay so how does it even work? dirconv attempts 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. so like, don't panic, but also… it's a thing. πŸ˜…

reliable detection of WTF-8 is only possible if the original 8-bit encoding is known. periodt. πŸ”

the exclusion filter is applied before name conversion. character classes are unlikely to work as expected on unconverted names. so don't come for me when your regex acts up bestie, i warned you. πŸ’€


🫢 that's the whole page! this was dirconv(1), dated November 18, 2014, and yeah, the footer really does just say DIRCONV(1) again. slay. πŸ’…βœ¨πŸŒΈ