Pergunta

as I am very new to rsync, I came across this code somewhere in the server and decided to try it out. It was a dry-run but there are a few parts within this line that I do not understand.

Do correct me if my interpretation below are wrong :x

find -name "*.jpg" | xargs -I icon sudo rsync -azuvhE -n icon tango:/jobs/prime/Item/icon

Firstly, I understand the first part of find -name "*.jpg" and it is looking for any .jpg files within the directory stated.

But I do not understand the meaning of | and xargs -I icon.. For the latter part, I presume it is like defining icon as a variable?

Then as for the last part, as I am crossing referencing between 2 servers (alphis which I am currently on) and tango, I presume it is referencing against the tango/jobs/prime/Item/icon?

Foi útil?

Solução

   find -name "*.jpg" | \     # find jpeg files (assume no white space)
          xargs -I icon \     # get file names from find, call them icon
          sudo rsync -azuvhE -n icon # copy each file to ....
          tango:/jobs/prime/Item/icon # this folder on tango

This should be an equivalent command:

sudo find -name "*.jpg" -exec rsync -azuvhE -n {} tango:/jobs/prime/Item/ \;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top