0

Suppose I have folder structure:

folder: a.text

folder_2: folder_3: a.text

How I can sync this file without mentioning the full destination path?

I have tried

rsync -hvrPt folder/* folder_2 

but it creates a new file under folder_2, instead I just want to update the a.text from folder to folder_2 without mentioning the full destination path.

I have tried

rsync --update

also but it didn't work.

Could anybody help me with this?

1
  • Not rsync but GNU cp(1) has the -u flag, just my two cents.
    – Jetchisel
    Feb 20 '20 at 23:56
0

It seems like you want rsync to update every found instance of the file. It won't do that. If you have just one file to update everywhere found in the target, you could try:

find folder_2 -name a.text -exec rsync -hvPt folder/a.text {} \; # no need for -r

I am not sure what you are doing with -h, unless you have really have hard links. It makes me think you are trying to update links versus files. Unless you have a good use case, you should probably use soft links (ln -s) as they can span file systems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.