On Thu, 22 Jun 2006, 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. > Never seen print0 before, but on my system it has the effect of putting all the filenames in single line. So grep -v eliminates the one line that it finds leaving nothing to pass to cpio. man find -print True; print the full file name on the standard output, followed by a newline. -print0 True; print the full file name on the standard output, followed by a null character. This allows file names that contain new- lines to be correctly interpreted by programs that process the find output. cpio will understand the output of -print just fine. No need to use print0 ------------------------------------------------------------------------ Jim Wildman, CISSP, RHCE jim at rossberry.com http://www.rossberry.com "Society in every state is a blessing, but Government, even in its best state, is a necessary evil; in its worst state, an intolerable one." Thomas Paine