2 ms·
I don't know, this seems like a lot of words to avoid coming to the conclusion that there are many ways to skin a directory. Most of the time it's fine to just
by cess11 2y ago
I don't know, this seems like a lot of words to avoid coming to the conclusion that there are many ways to skin a directory.
Most of the time it's fine to just suck in ls and split it on \n and iterate away, which I do a lot because it's just a nice and simple way forward when names are well-formed. Sometimes it's nicer to figure out a 'find at-place thing -exec do-the-stuff {} \;'. And sometimes one needs some other tool that scours the file system directly and doesn't choke on absolutely bizarre file names and gives a representation that doesn't explode in the subsequent context, whatever that may be, which is quite rare.
A more common issue than file names consisting of line breaks is unclean encodings, non-UTF-8 text that seeps in from lesser operating systems. Renaming makes the problem go away, so one should absolutely do that and then crude techniques are likely very viable again.