On Thu, 22 Jun 2006, William L. Maltby wrote: > On Thu, 2006-06-22 at 07:21 -0500, Robert wrote: >> Can someone explain why this: >> find . -depth -print0 | cpio --null -pmd /tmp/test >> will copy all files in and below the current directory -and- this: >> find . -depth -print | grep -v .iso$ | wc -l >> will count all the non-iso files -and- this: >> find . -depth -print | grep .iso$ | wc -l >> will count *only* the iso files -but- this: >> find . -depth -print0 | grep -v .iso$ | cpio --null -pmd /tmp/test >> doesn't copy *anything*? >> Any suggestions for a work-around would also be most welcome. > > Replace the print0 with print. If you need to know why, redirect your > find print0 output to a file & then do an od -c on it. > > Hint: cpio expects one entry per line (in spite of what it did for you) > and grep operates on lines of input. If it's not clear after doing the > od -c, call again. :-) cpio, like xargs, can accept an argument list terminated by a null character rather than whitespace. That what the OP was doing with the --null switch (aka -0, also possible with xargs). It's very helpful with unpredictable filenames. -- Paul Heinlein <heinlein at madboa.com>