Copy all files except one

How can I copy all the files in a given directory except one.

cheers

does the file that u are talking about has a special syntax , date or time , does it have any kind of specifications that differentiate it from the others ...
please also post the operating system , version and hardware .

you could mv the file you don't want copied to a temp directory... copy what you like and then mv the file back to where it was

hope this helps

Run this from the directory where all the files are.

find . -type f -prune ! -name <file to be not copied> -exec cp {} /path/to/newdir \;

That doesn't compute. What is the -prune going to do here? find can't desend into files. It only makes sense to prune directories. :confused:

Whoops...My mistake. That's twice this week I've posted incorrect advice. Sorry to all.

In bash you can set GLOBIGNORE...

export GLOBIGNORE='file1'
cp * /dir1/

Try this ...

 cp `ls --ignore=file1` destinationDir

1 Like