LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   exclude directory with cp (https://www.linuxquestions.org/questions/linux-software-2/exclude-directory-with-cp-124930/)

hampel 12-11-2003 10:54 AM

exclude directory with cp
 
Hello,

I want to exclude an directory from copying.
cp --exclude ... does not work.

Any ideas?

regards

trickykid 12-11-2003 11:04 AM

Looking at the man page there is no exclude option: http://man.linuxquestions.org/index....ction=0&type=2

Why not just delete afterwards?

cp -R <directory/filename> | rm -rf <directory-filename>

andrewlkho 12-11-2003 12:05 PM

Or, if the directory happens to be very large, and so you don't want to waste cpu resources copying it just to delete it, then move the directory up a level, which won't take up much time, and then copy it, then replace it.

Daantje 06-04-2009 11:59 AM

Or use rsync to copy, it does have an --exclude option.


All times are GMT -5. The time now is 08:52 PM.