A question about Terminal volume names

I have a simple rsync that I run every day through an Applescript that basically syncs over two directories of files to my computer locally. However, for some unknown reason my volume names sometimes get -1, -2 etc added to the end of the them when connecting through Terminal, breaking my scripts. Is there a good way to find what the name of a shared volume will resolve to using Applescript, to keep this from happening?

My script looks like this. Can wildcards be used for the volume names perhaps?

rsync -uravv --delete /Volumes/Mac\ HD\ Work-1/Scans\ Master/Image\ Archive/g8 /Volumes/Powerbook\ 2/Main/Local\ Image\ Cache/

Model: Macbook Pro
AppleScript: 10.7.x
Browser: Safari 535.19
Operating System: Mac OS X (10.7)

The only reason I know of for that sort of renaming is when there’s a volume of the same name already mounted.

Its seems to be confusion about the volume still being “mounted” but not really, since the other computer restarted once, and it sees it as a new share. I’d love to find a way to use wildcards, will they work in a situation like this?

Can you get a list of mounted volumes, and work from there?

Ppayne:

A good backup script does the following:

  1. check if the volume is mounted (use mount)
  2. if not create in you working directory a node (I never use /Volumes as my working directory; use mkdir)
  3. mount the volume to the node (use mount)
  4. run rsync
  5. unmount the volume (use diskutil to avoid finder craches).

The problem you described is a node problem. Nodes are like directories and you can’t have two directories with the same name in the same directory. For me a reason not to work in the /Volumes directory to avoid duplicate names. Also I prefer to mount and unmount the volumes by the script. This way the script only runs (I build controls in as well) rsync when the volume is successfully mounted. Another reason to do the mounting by script and not in /Volumes is that I can do an ‘invisible’ mount.

Thanks very much! That worked swimmingly! Now I make a directory in home, mount the volumes there, rsync and unmount when done.