Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 12-11-2003, 11:54 AM   #1
Registered: Jun 2003
Posts: 62

Rep: Reputation: 15
exclude directory with cp


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

Any ideas?

Old 12-11-2003, 12:04 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 234Reputation: 234Reputation: 234
Looking at the man page there is no exclude option:

Why not just delete afterwards?

cp -R <directory/filename> | rm -rf <directory-filename>
Old 12-11-2003, 01:05 PM   #3
Registered: Jul 2003
Location: London
Posts: 548

Rep: Reputation: 30
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.
Old 06-04-2009, 12:59 PM   #4
LQ Newbie
Registered: Aug 2005
Location: Amsterdam, Netherlands
Distribution: Debian Lenny
Posts: 4

Rep: Reputation: 1
Or use rsync to copy, it does have an --exclude option.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
CHMOD with an exclude? nicedreams Linux - General 8 06-16-2016 12:22 PM
[SOLVED] grep exclude Manuel-H Linux - General 4 10-12-2010 09:50 PM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 08:31 PM
tar exclude-from drisay Slackware 1 12-23-2004 02:10 PM
exclude directory from find ebasi Linux - Software 8 07-17-2004 03:12 AM

All times are GMT -5. The time now is 11:25 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration