I'm trying to develop a file updater for my remote server. So each time I modify some code files on my workstation, I would run
rsync and it would modify the code files on the remote server.
So imagine if I modify the file
/home/myuser/workspaces/project/folder/file.txt I would want to sync it to
email@example.com:/work/folder/file.txt. As you can see, the server maintains the folder structure, although it skips the irrelevant part
If I execute the rsync from
/home/myuser/workspaces/project/ it's easy to solve, since I just have to add the
$ cd /home/myuser/workspaces/project/ $ rsync -aR folder/file.txt firstname.lastname@example.org:/work
This would do the trick. The problem is that I don't know where the command will be executed from, so I have to add the whole path
/home/.../file.txt, and using the shown command would save everything into:
Is there any solution to what I want to implement?
By the way, at the moment of the
rsync, it could be possible that
/work/, at the remote host, is an empty folder.