Re: how to copy dir by excluding some subdir?

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

 



yonas Abraham wrote:
i want to copy one directory with big sub directory and files on it
with the exception of some of its sub directories.

I usually just do cp -r A B, and go to B and delete the once that I
don't need it. But this becomes expensive as the size of the subdir
gets bigger and bigger.

I was hopping something like cp -r --exclude=C A B, to copy dir A to B
with the exception of dir C which is a sub dir of A. But man cp,
didn't give me such thing.

any help?

Thanks


Maybe tar could do this with the --exclude option (not sure if it works with directories), using the typical pipe to extract to a destination on the fly.

Or with cpio:

find some/dir | grep -v some/dir/to/exclude | cpio -pdm /dest

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
            University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@xxxxxxxxxxxx
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux