Operating System - HP-UX
1821062 Members
2508 Online
109631 Solutions
New Discussion юеВ

Use cpio command to copy everything except some files

 
SOLVED
Go to solution
Michael Yu_1
Occasional Contributor

Use cpio command to copy everything except some files

Is there any way I can use cpio command to copy everthing in the directory except some files or sub-directory? I usually umount those sub directory that I don't want to copy but I have to do this in off-hour since I have to umount them. I wish I can run cpio commnad to exclude some sub-directories that I don't want to copy. Thanks.
2 REPLIES 2
Alzhy
Honored Contributor
Solution

Re: Use cpio command to copy everything except some files

cd /srcdir
find ./ -depth -print|grep -v exclude_dir/files |cpio ....

Hakuna Matata.
Hari Kumar
Trusted Contributor

Re: Use cpio command to copy everything except some files

use the "f" option available with cpio which copies the files except those specified in the pattern
cpio -i f [pattern.........]
u can use even not these as " ! "leading, which select not matching part of this expression
Information is Wealth ; Knowledge is Power