Copy all except one file?
Peter Garrett
peter.garrett at optusnet.com.au
Sat Jul 29 17:31:19 UTC 2006
On Sat, 29 Jul 2006 19:50:08 +0800 (CST)
Soo Qing <sooqing at yahoo.com.sg> wrote:
> Hi!
>
> I often need to copy all files (*) except one file
> (example.txt) from one directory to some places. How
> do I do that from the terminal?
>
This appears to do the job:
$ cp $(ls | grep -v *.txt) /path/to/destination-for-copied-files
For instance:
peter at prospero:~/test $ touch foo.blah bar.foo bleh.txt
peter at prospero:~/test $ ls
bar.foo bleh.txt foo.blah
$ cp $(ls | grep -v *.txt) ~/copy/
peter at prospero:~/test $ ls ~/copy
bar.foo foo.blah
I'm sure there are other ways, but that's what came to mind :)
Peter
More information about the ubuntu-users
mailing list