I've checked out a few questions but none have helped so far.
I have an AppleScript backing up my RAW files from one HDD to another, and I'd like to include a NAS drive in that process. I'm using rysnc
to copy the files, but I'm having trouble referencing the NAS Drive in my rsync
command.
I have a line of code referencing the NAS Drive as a test which is working:
do shell script "open 'smb://NASDrive/Matt RAW Backup/Backups'"
However, the following line of code isn't working:
do shell script "rsync -a '/Users/Matt/Desktop/Test Folder/' '/Volumes/NASDrive/Matt RAW Backup/Backups' --delete"
('NASDrive' is the name of the NAS Drive, and 'Matt RAW Backup' is the share name)
I get the following error in the 'Result' bar:
error "ssh: Could not resolve hostname smb: nodename nor servname provided, or not known rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-51/rsync/io.c(453) [sender=2.6.9]" number 255
Does anyone know why the rsync
command is failing, but the open
command with the same reference to the folder is working?
It's probably a timing issue.
I recommend to use the AppleScript mount volume
command and wait until the disk appears in /Volumes
You need to replace server.local
with the server name of your NAS.
set diskName to "NASDrive"
try
mount volume "smb://server.local/" & diskName
repeat until diskName is in (do shell script "ls /Volumes")
delay 0.2
end repeat
do shell script "rsync -a '/Users/Matt/Desktop/Test Folder/' '/Volumes/NASDrive/Matt RAW Backup/Backups' --delete"
on error e
display dialog "An error occurred: " & e
end try