[wellylug] cpio pattern nonmatching

E.Chalaron e.chalaron at xtra.co.nz
Tue May 11 11:13:17 NZST 2004


Hi everybody

I am still working on processing directories and filenames. 
Today is Cpio day :-) to sort out files

find . -depth -print0 | cpio -pd newdir

find . -depth -print0 | cpio -pudmv newdir

Works fine, create all directories as expected.
Now, the original directories contain a bunch a various file. 
Used a such the all lot is copied e.g. I have a copy of a bunch of various 
files. Good but not quite what I want.

Now cpio offers the following
*******************************************************************
-E FILE, --pattern-file=FILE 
Read additional patterns specifying filenames to extract or list from FILE. 
The lines of FILE are treated as if they had been non-option arguments to 
cpio. This option is used in copy-in mode, 
-f, --nonmatching 
Only copy files that do not match any of the given patterns. 
*******************************************************************

find . -depth -print0 | cpio -pudmv --pattern-file=FILE --nonmatching newdir
My question is then :
What should I use instead of FILE to filter out let's say *.doc ?
I tried several --pattern-file='*.doc' or "doc"... no way.
I am a bit confused on how to use  this option properly
Thanks a lot
Edouard




More information about the wellylug mailing list