I’m trying to write a script to copy, then uncompress a virtual machine into the proper folder. I was going fine on my test box, then i tried it on another box and realized i never put a check in to see if the folder existed so I made a mighty stab at doing that only to confuse myself even more. I also realized I hadn’t accounted for different user names, but I think I accounted for that now. Is anyone willing to look at my script and tell me where I went wrong and what I could do to improve it?
Len
tell application "Finder"
set path_1 to "Users:[home]:Documents:Virtual Machines:"
set path_2 to POSIX path of path_1
set path_3 to "Volumes:Kingston:Extra Files:"
set path_4 to POSIX path of path_3
set path_5 to "Users:[home]:Documents:
set path_6 to POSIX path of path_5
end tell
tell application "Finder"
if (not exists with properties {name:"Virtual Machines"}) in folder "Users:[home]:Documents:"
then
make new folder at "users:[home]:Documents:" with properties {name:"Virtual Machines"}
end if
end tell
say "Beginning file copy"
do shell script "/bin/cp " & quoted form of path_4 & "Windows7HomePremium.zip " & quoted form of path_2
say "File copy complete"
say "beginning file decompression"
do shell script "unzip -u " & quoted form of path_2 & "Windows7homepremium.zip" & " -d " & quoted form of path_2
say "file decompression complete"
do shell script "rm " & quoted form of path_2 & "Windows7homepremium.zip"
Model: Macbook Pro
Browser: Safari 531.9
Operating System: Mac OS X (10.6)