On Aug 9, 2013, at 23:26 , Dave C wrote:
OK, first attempt. I'm getting "Syntax Error: Can't set thatdisk with replacing to myfile Access not allowed."
Thanks,
Dave
- - -
- Why the mount operations? Rarely does the system skip mounting a volume.
.... If you know the volume name ahead of time (as you seem to do) can't you just use it without the mount/grep stuff?
.... Alternatively, if the names are different each time, try a choose folder operation for the user to pick a drive.
set mydisk to (do shell script "diskutil list | grep 'ReallyTiny'")
do shell script "diskutil mount " & (last word of mydisk)
set thatdisk to (do shell script "diskutil list | grep 'Tiny650'")
do shell script "diskutil mount " & (last word of mydisk)
- A "delay 5" or similar interval might be good here as shell might return before the volume is really mounted and ready.
- for a task like this it may be better to use the shell rather than the Finder
e.g.: do shell script "cp '" & sourceFilePath & "' '" & targetDirPath & "';"
tell application "Finder"
set myfile to alias "/Volumes/ReallyTiny/Down The Rabbit Hole.mp4"
* make your target path a directory rather than the file name at the target path.
e.g.: /Volumes/ReallyTiny/
set thatfile to file "/Volumes/ReallyTiny/Down The Rabbit Hole.mp4"
copy myfile to thatdisk with replacing
* Use the "duplicate" command, as "copy" is a language keyword.
-- duplicate myfile to thatdisk with replacing
end tell
-=-=-=-