Rsync list of specific local files in 1 step

I am working on a web application when a user uploads a list of files, which should then be immediately deleted on a remote server. I have a list of all the local files that rsynced needs, but they will mix with other files that I don't want rsynced every time. I know that rsync will only send modified files, but this directory structure and its contents will be very large over time, and the delay will be unacceptable.

I know that by running remote rsync, I can specify a list of deleted files, i.e. ...

rsync "host: / path / to / file1 / path / to / file2 / path / to / file3"

... but this does not work when I delete "host:" and try to locate files locally.

I also know that I can use -files-from, but this would require that I create a file list file in advance that I want to use rsync (and then delete it later). I think it would just be easy to say “rsync these 4 specific files to this remote server”, but I can't get this to work.

Is there a way to do what I'm trying to accomplish, or do I need to resort to creating a tmp file with a list in it?

Thanks!

+4
source share
1 answer

You should be able to display files similar to the example you provided. I did this on my machine to copy 2 specific files from a directory with a lot of other files.

rsync test.sql test2.cpp myUser@myHost :path/to/files/synced/ 
+7
source

All Articles