18

I am trying to copy all newer jpgs from one folder to another using the following command

cp -u --force /home/oldfolder/*.jpg /home/newfolder/

and I get the following promt:

cp: overwrite `/home/newfolder/4095-181.jpg'?

The '-u' I know is working fine as is it only prompting me on the newer files, but i dont want to get the prompt i just want it to overwrite them. I have tried --force and -f

Any suggestions?

Thanks in advance

icelizard
  • 732
  • 3
  • 9
  • 20

4 Answers4

36

Maybe your cp command is an alias? Try:

\cp -uf file folder/
ko-dos
  • 1,359
  • 8
  • 10
18
yes | cp <whatever else>
robjmills
  • 990
  • 8
  • 24
9

Type "type cp" to see where it points, or if it is aliased.

  • 1
    Had the same problem. Entering `type cp` revealed that `cp` was an alias for `cp -i`, and obviously `-i` (interactive) takes precedence over `-f` (force). – Peter Boughton Dec 15 '10 at 19:51
2

Use full path to cp , it will override the alias

/usr/bin/cp -u --force /home/oldfolder/*.jpg /home/newfolder/
Mick
  • 31
  • 1