[Top][All Lists]

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

Re: exclude option for cp

From: Bob Proulx
Subject: Re: exclude option for cp
Date: Sat, 30 Jun 2007 12:17:35 -0600
User-agent: Mutt/1.5.9i

Richard van der Leeden wrote:
> 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'

This is not doing quite what I think you think it is doing.
Use 'echo' to show what arguments are being passed to the command.

  echo cp -rvf !(*~|.scratch) /tmp/dir2

I expect this to show that the shell has already expanded that shell
file glob to match (or not match) the files in the current directory.
Because the -r option is specified if one of those is a directory then
the full contents of the directory will be copied recursively.

This type of operation is much better done using the modular tools
such as already posted by others.


reply via email to

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