Mysterious rsync problem

Mysterious to me at least…

I’m backing up a compact flash card from my Akai Z8 sampler ( I just like it, ok!) using this script:

set source to “/Volumes/128 GB CARD/”
set destfolder to “/Volumes/Home Drive/Desktop/B”

do shell script "/usr/bin/rsync -rt --delete " & (quoted form of source) & " " & (quoted form of destfolder)

and I get this error:

error “file has vanished: "/Volumes/128 GB CARD/Organised/Keys/WCID?"
IO error encountered – skipping file deletion
rsync warning: some files vanished before they could be transferred (code 24) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]” number 24

The file/folder WCID is not on the card now but it used to be maybe 4 months ago before I deleted it. I have used this script to successfully copy files around on the Mac. The card will be formatted master boot record.

To give some perspective, I want to write two scripts, one to copy the card to the Mac, then one to copy it back once I have moved/deleted files. Not sure if this is relevant.

stratblue. I tested your script on my computer using a flash drive as the source and my boot drive as the target. I received the following errors:

So, copying an entire flash drive might not be the best idea. I tried the following and it worked without error on my computer with the flash drive. However, I did not use it with the delete option because I didn’t want to delete everything on my flash drive.

do shell script "/usr/bin/rsync -rt " & (quoted form of source) & "* " & (quoted form of destfolder)

Another option would be to use System Events to get a list of every file and top-level folder on the flash drive that is visible, and then to use this with rsync with the recursive option. I do this with another drive and it works well.

set theFolder to "/Volumes/Backup 2/"

tell application "System Events"
	set sourceFolders to POSIX path of (every item in folder theFolder whose visible is true)
end tell

repeat with aFolder in sourceFolders
	set contents of aFolder to (quoted form of aFolder) & space
end repeat

BTW, I’m not familiar with Akai Z8 sampler and perhaps all the hidden and system files are necessary.

Thanks peavine.

I used the same script to copy just the “organised” folder and it hung with the same error.

I tried and app called folder sync and it claims that there are no files to sync.

I ran Whatsize and it reveals that there is a file or folder called WCID? with a size of 0kb in the folder “keys”. The reveal in finder function does nothing though…

Stratblue. I wasn’t thinking well when I responded to your post. I don’t have a flash drive with Akai Z8 sampler, and I don’t even know what it does, so I should not have posted.

I do have two suggestions but they are obvious and I’m sure you’ve already tried or considered them. The first is to check the flash drive for errors. The second is to use one of rsync’s exclude options. This masks rather than fixes the issue, so it’s not a good solution. Sorry I couldn’t be more help.

When you received this error, was it the first time you attempted to backup or have there been subsequent runs, and was the end point originally an empty folder? If so, there would be no need for the delete option, as it only deletes files from the destination that aren’t in the source. You could try changing the options or looking at invisible files/folders to make sure the offending item is actually nonexistent.

do shell script "rsync -rt --delete-after −−ignore−errors " & source's quoted form & space & destfolder's quoted form

—or the more standard:

do shell script "rsync -au " & source's quoted form & space & destfolder's quoted form

tell application "Finder" to delete (choose file with invisibles) —or choose folder

Thanks for your suggestions, I have solved it now, managed to find the file with the Akai and delete it. All running smoothly.