The original folder being synced is the in the first part of the line after the rsync options given the
/Volumes/drive\ 1/photos in there that tells rsync to sync the directory photos on/in the /Volumes/drive\ 1 volume. The synced to destination is in the second part the
/Volumes/drive\ 2/ volume. This when ran results in the photos directory on the /Volumes/drive\ 1 drive being synced to the /Volumes/drive\ 2/ drive in what will be a photos directory on it once the sync is done. In short when you want to sync a directory you go with this rsync options_used /Volumes/Drive/Directory_To_Sync then the destination where you want the directory to be created on/synced to the /Volumes/Drive_To_Sync_To/. You do not put the directory in the synced to part rsync does that automatically and the trailing / on the destination is needed to let it know to sync in that drives folder structure not the entire drive it self as the sync destination.
Edit: here is a snippet of my script I use to backup my main storage machine to a backup for my TV shows I have stored, it may help you see what is needed for your script you are trying to do.
Code:
MacUser2525:~$ cat Bin/primary.sh
#!/bin/bash
echo "Syncing TV_x265"
rsync -avP --delete --exclude ".*/" $1 /Volumes/TV_x265 storage1@192.168.0.102:/Sans_Digital/
Now here you can see it is a bash script by the first line the #!/bin/bash then I echo to the Terminal what it is going to do namely sync my tv shows that are in x265. Then the real task at hand use rysnc to archive the -a verbosely the v using progress option the P which allows you to killl of the process and have it resume without having to start from the beginning a file that has been partially copied. The --delete will delete any file on the destination that is not present on the source directory. The --exclude ".*/" skips any of the hidden files that OSX uses like the .ds_store as it is linux machine I am syncing to and they are not needed there. The $1 allows me to pass another option into the script at run time like a --dry-run to have it show me the changes that will be made without actually doing anything before I really run the script to have it done. I am syncing the directory /Volumes/TV_x265 on my source to the user storage1 at the 192.168.0.102 IP address on my home network in the destination directory /Sans_Digital/.
I'm a novice at this although I have used the Terminal before to define file paths. In the past dragging in folders into the Terminal has been a good way to establish pathing, but this time it's not working so well.
Today using this link:
https://www.bananica.com/Geek-Stuff/Synchronize-two-folders-on-a-Mac-with-Automator-and-Rsync/ I was actually able to create an automator script that syncs up the two files I choose, but I would prefer to have the folders set up in advance.
So with the goal of creating an Automator script, I still have to insert a terminal script. Based on that here is my example: I have two folders I am syncing on two different hard drives:
MBBB1
(Partition)/MBBB1 Backed up
(folder)
WDFire 2
(Partition)/MBB1 Backed up
(folder)
Now in the Terminal if I drag these folders into the Terminal, these are how the paths are displayed.
/Volumes/MBBB1/MBBB1\ Backed\ Up
/Volumes/WDFire2/MBBB1\ Backed\ Up
I'm trying to put together a script so the the second folder is synched with the first folder and old files are deleted. I'm thinking it should look something like this:
rsync -aE –delete ~/ <source folder> / “<destination folder>” or should there be two dashes like:
rsync -aE -–delete ~/ <source folder> / “<destination folder>” ?
But in the examples I found on line sometimes there are quotes ("") around both the source and destination file, and sometimes just around the destination file and sometimes neither. So it might look like one of the following:
rsync -aE –delete ~/Volumes/MBBB1/MBBB1\ Backed\ Up “/Volumes/WDFire2/MBBB1\ Backed\ Up”
or
rsync -aE –delete "~/Volumes/MBBB1/MBBB1\ Backed\ Up" “/Volumes/WDFire2/MBBB1\ Backed\ Up”
or
rsync -aE –delete ~/Volumes/MBBB1/MBBB1\ Backed\ Up /Volumes/WDFire2/MBBB1\ Backed\ Up
If it's not too much trouble could you tell me what you think the successful script would be?
I've tried different variations and am continuing to get errors when using the terminal.
Thanks!