LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Copy directory execlude directory (https://www.linuxquestions.org/questions/linux-general-1/copy-directory-execlude-directory-509637/)

linux2man 12-12-2006 03:18 AM

Copy directory execlude directory
 
Hello;
I'd like to copy all contents of directory except directory name Library, what's syntax should I use.
for example:-
ls /home/user/
redhat centos fedora library and so on
I'd like to copy /home/user/* except library directory

Berto 12-12-2006 03:55 AM

cp -r /home/user/* /cpdir/ && rm -r /cpdir/library

The "copy files from directory to directory without subfile" thread in the Similar Threads just below also has a solution, but this method seems much less tedious. (Unless of course the "library" directory is so huge it would take hours to copy the whole thing)

linux2man 12-12-2006 07:48 AM

Quote:

Originally Posted by Berto
cp -r /home/user/* /cpdir/ && rm -r /cpdir/library

:tisk:
all files which i need to copy about 10MB but Library directory is 30GB.
I need to use wildcard.

homey 12-12-2006 07:52 AM

I like to use rsync with exclude='somedirectory'
For example:
rsync -av --exclude='.thunderbird' /home/fred/ /etc/skel


All times are GMT -5. The time now is 10:23 AM.