Re: [CentOS] OT -- BASH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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.

What does this give you?
find . -depth -print0 | grep -v .iso$

The print0 option causes all the file names to be on a single line.  So
when you grep out .ios$ you're losing the whole line.

Here's a tar alternative to the other cpio based solutions:
# mkdir /tmp/test
# tar cf - . --exclude '*.iso' | (cd /tmp/test; tar xvf  -)




_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


--
Mark Belanger
LTX Corporation
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux