3 ms·
Nice to know, thanks! But, how does it work with file names containing spaces (or other strange characters)? Edit: just to clarify: my question concerns the zs
by pif 14y ago
Nice to know, thanks! But, how does it work with file names containing spaces (or other strange characters)?
Edit: just to clarify: my question concerns the zsh method. Regarding find+xargs, I wrote that comment :-)
Actually, this edit would be an answer to zap; HN does not let me reply directly to him: is it to prevent flame-wars?
- zaptheimpaler 14y agoThats what the print0 arg in find and the --null arg in xargs are for. print0 prints the file name followed by a NULL character (rather than newline) Using the --null/-0 arg makes xargs look for NULLs as delimiters and treat everything else literally.
- q_revert 14y ago/tmp/ $ mkdir -p test1/test2/test3 /tmp/ $ touch test1/test2/test3/test4 /tmp/ $ ls -ltr test1/**/*(.) -rw-r--r-- 1 usr grp 0 Aug 9 11:11 test1/test2/test3/test4 /tmp/ $ touch test1/test2/test3/test\ with\ spaces /tmp/ $ ls -ltr test1/**/*(.) -rw-r--r-- 1 usr grp 0 Aug 9 11:11 test1/test2/test3/test4 -rw-r--r-- 1 usr grp 0 Aug 9 11:12 test1/test2/test3/test with spaces