Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 2
    Someday I will run into a bunch of Chinese files and I'll be very glad I've read your many answers about locale and valid characters. :) Commented Dec 14, 2016 at 23:37
  • 2
    @Wildcard, you (and even more so a Chinese person) is more likely to run into problem with British, French... file names than Chinese file names as Chinese filenames are more often encoded in UTF-8 than file names of alphabetical scripts that can generally be covered by a single-byte charset which was the norm up until relatively recently. There are other multi-byte charsets to cover Chinese character, but I'd expect Chinese people would have switched to UTF-8 earlier than westerners as those charsets have a number of nasty issues. See also the edit for an example. Commented Dec 15, 2016 at 9:22
  • How does your boolean expression equivalent for -maxdepth 2 work? Assume, I have PATH_1=/a/b/c/d and PATH_2=/a/b/c/d/e, and I'm going -maxdepth 2 from /a/b, and d and e are files, not dirs. ! negates, so it would negate the outcome of the -path primary. With -path '/a/b/*/*', PATH_1 matches and is true then negated to false. The -o causes us to go -prune, but d is a file so nothing happens. The path is then printed to stdout. PATH_2 doesn't match -path '/a/b/*/*' and is false, then negated to true`. What happens now? Commented Aug 17, 2021 at 23:56
  • Apologies, the comment above looks like a wall of text. I tried adding line breaks with SHIFT+ENTER and it didn't work out :( I appreciate your help in understanding this. Commented Aug 17, 2021 at 23:57
  • 1
    @Ungeheuer, -prune returns true (like GNU find's -true) with the added side effect that if applied on a file of type directory, find will not descend into it. So if you do find /a/b/., /a/b/./c/e will match -path '*/./*/*' and so -prune will be applied to it and find will not look for files into it, so will never come across /a/b/./c/e/f Commented Aug 19, 2021 at 6:38