LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copy all files except from some certain folders. (https://www.linuxquestions.org/questions/linux-newbie-8/copy-all-files-except-from-some-certain-folders-783286/)

eikhorsholm 01-19-2010 02:07 PM

Copy all files except from some certain folders.
 
At the moment I'm using:
"cp -ap . /destination-folder"
to copy everything from the folder I'm in to another folder.
That works.

Is it possible to cp everything except:
folder1/
folder2/
in the current folder I'm in?

unSpawn 01-19-2010 02:21 PM

You need something that you can easily --exclude things with. Two tools come to mind: 'tar' and 'rsync'.

chrism01 01-19-2010 04:53 PM

As implied by unSpawn, there is (unfortunately) no --exclude option for cp.
Other solutions include:

1. cp everything, then rm at the destination
2. write a short script to call cp, skipping those dirs


All times are GMT -5. The time now is 07:24 AM.