3 ms·
>GP's version is buggy in the same way as the post misunderstands, particularly with files that somehow got newlines in the filename I understand this caveat,
by hifromwork 2y ago
>GP's version is buggy in the same way as the post misunderstands, particularly with files that somehow got newlines in the filename
I understand this caveat, but I never had a file with newline that I cared about. Everyone keeps repeating this gotcha but I literally don't care. When I do "ls | grep [.]png\$ | xargs -i,, rm ,," (yes, stupid example) there is 0% chance that a png file with a newline in the name found itself in my Downloads folder. Or my project's source code. Or my photo library. It just won't happen, and the bash oneliner only needs to run once. In my 20 years of using xargs I didn't have to use -0 even once.
- Izkata 2y agoSee the other response I got, I misremembered (and waaay too late to edit) - it's whitespace, not newlines. I'm sure you've had files with spaces in the name.