I think i am being a bit thick...

Dear All
I am trying to make a script that mounts a DMG image file, then moves the entire contents of a folder to a folder in that DMG image, ejects the volume and then deletes and secure erases the contents of the original folder.

I have got this far:

do shell script "hdiutil mount '/Users/Mat/Documents/Vault.dmg'"

tell application "Finder"
	set sourceFolder to "/Users/Mat/Downloads/Portal"
	set targetFolder to "/Volumes/Vault2/From Portal"
	move entire contents of sourceFolder to targetFolder
	eject "Vault2"
end tell

So i can mount the file and it ejects ok but when it trys to copy the files into the folder it returns

Result:
error “Can’t get entire contents of "/Users/Mat/Downloads/Portal".” number -1728 from «class ects» of “/Users/Mat/Downloads/Portal”

I’m a bit confused and any help would be much appreciated.

Ive not even started to figure out the secure erase of the source yet.

Thanks in advance

Hi,

AppleScript doesn’t know POSIX paths (slash separated), it works only with HFS paths (colon separated).
As opposed to AppleScript the shell works only with POSIX paths


set vaultImage to POSIX path of (path to documents folder) & "Vault.dmg"
do shell script "hdiutil mount " & quoted form of vaultImage

set sourceFolder to (path to downloads folder as text) & "Portal:"
set targetFolder to "Vault2:From Portal:"
tell application "Finder"
	move entire contents of folder sourceFolder to folder targetFolder
	eject "Vault2"
end tell

Fantastic. All sorted now and i managed to sort the secure erase thing.

THANKS AGAIN!!

As you already trigger a shell script, why aren’t you using mv to move your files ?

Yvan KOENIG (VALLAURIS, France) mardi 21 février 2012 16:47:09