bug-coreutils
[Top][All Lists]
Advanced

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

Re: exclude option for cp


From: Richard van der Leeden
Subject: Re: exclude option for cp
Date: Sat, 30 Jun 2007 10:34:10 -0700 (PDT)


Francky Leyn-2 wrote:
> 
> I have the following problem.
> I have DVD's with backups of multiple UNIX account.
> I now have to restore them. I do this with cp -rfv.
> What I would like is that I would be able to exclude
> local wastebaskets with directory name .scratch and
> the files in it. I would also like to be able to exclude
> files with a name *~ from the copy. I know I can do this
> with find, but it would be much more convenient if cp
> would have an option to exclude files from copying.
> Suppose this option would be triggered with -e or --exclude
> I then would be able to specify the copy as:
> cp -rvf -e '*~' -e .scratch
> 

I think this is already possible, or am I misunderstanding something?

Copying everything from dir1 to dir2:

cp -rvf . /tmp/dir2
`./file1' -> `/tmp/dir2/./file1'
`./file2' -> `/tmp/dir2/./file2'
`./file3' -> `/tmp/dir2/./file3'
`./.scratch' -> `/tmp/dir2/./.scratch'
`./.scratch/dontcopy' -> `/tmp/dir2/./.scratch/dontcopy'
`./dontcopy~' -> `/tmp/dir2/./dontcopy~'

Copying everything apart from files ending in ~, and .scratch dirs and files
therein:
cp -rvf !(*~|.scratch) /tmp/dir2
`file1' -> `/tmp/dir2/file1'
`file2' -> `/tmp/dir2/file2'
`file3' -> `/tmp/dir2/file3'

-- 
View this message in context: 
http://www.nabble.com/exclude-option-for-cp-tf3972180.html#a11375165
Sent from the Gnu - Coreutils - Discuss mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]