I'm trying to use find & rsync to back up specific files from a remote machine, and getting nowhere.
Here's the setup: I want to use rsync to back up all files containing *state*
or *srm
on the remote machine into a local directory. I specifically want to run this from my local machine, rather than running it with find on the remote machine (a RetroPie, if you're curious), because I don't want to set up login credentials from the remote machine. I already have ssh keys set up properly. I'm aiming to backup into ~/retropie-backup locally.
The find command that I'm using works properly on the remote machine (truncated to one result for clarity):
$ find -iname "*state*" -o -iname "*srm"
./RetroPie/roms/snes/EarthBound (USA).srm
So far so good. I also know that I need to add -s to rsync so it doesn't panic over spaces in the file names. My attempt at combining the two, however, doesn't work:
$ rsync -v -s pi@retropie:'`find -iname "*state*" -o -iname "*srm"`' retropie-backup/
rsync: link_stat "/home/pi/`find -iname "*state*" -o -iname "*srm"`" failed: No such file or directory (2)
I can tell that I'm missing something basic, but I'm just not seeing it. Any suggestions?