Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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/ \;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top