views:

117

answers:

2

I am trying to copy all jpgs from 1 directory to another but only new files and ones that have been updated.

I am using the following command:

\cp -uf /home/ftpuser1/public_html/ftparea/*.jpg /home/ftpuser2/public_html/ftparea/

And I am getting the error:

-bash: /bin/cp: Argument list too long

I am assuming that there are 2 many files in this directory for the cp command to work

I have also tried:

find  /home/ftpuser1/public_html/ftparea/ -name "*jpg" -exec cp -uf {} /home/ftpuser2/public_html/ftparea/

and got the following:

find: missing argument to `-exec'

Any ideas?

A: 

Using find you shouldn't have the brackets in quotes. Try this

find  /home/ftpuser1/public_html/ftparea/ -name "*jpg" -exec cp -uf {} /home/ftpuser2/public_html/ftparea/ \;
Glen
still getting same error: find: missing argument to `-exec'
Lizard
did you include the \; at the end of the find command?
Glen
+1  A: 

You need to make sure to include the final “\;” to finish the command that -exec should execute.

Bombe
thanks! silly me!
Lizard