I’d like to have an applescript to erase or format a disk or volume (in this case CompactFlash cards -connected through a firewire cardreader- that all have the name “EOS_DIGITAL”), but Googling my way thru the web I can’t find any hints on how to do it. Should be possible, don’t you think? Anyone?
Jeroen
Model: G3 iBook, G5 PowerMac
Browser: Safari 312
Operating System: Mac OS X (10.3.9)
don’t get angry, am not being sarcastic, tried it 3x yesterday, didn’t work, maybe i missed something, will try again later today, will post results afterwards. am trying to delete the contents of my flash drive.
other than deleting the contents, can the volume be formatted via applescript?
NAh, my CompactFlash cards are also formatted in FAT16 (in-camera). You are using a cardreader I assume, not connecting your camera directly to your Mac?? And, did you try to manually delete files and (sub)folders from the finder??
The described method workes for me on Jaguar and Tiger. Copy everything below between <<< and >>> and paste that into scripteditor.
<<<
do shell script “rm -rf /Volumes/EOS_DIGITAL/*”
I tried it again this morning with a freshly installed tiger, it works, i wonder what went wrong with my panther. it donesn’t have anything to do with file permissions.
here’s a batch script to erase zip disks i just wrote after searching for a good way to erase disks. not perfect or too elegant but it works nicely. save as a stay open script.
set tcont to "Continue"
repeat until tcont is not "Continue"
set treply to ""
tell application "Finder"
activate
set tdisks to every disk whose size < 1.005E+8 and size > 100
if (count tdisks) = 1 then
set tdisk to item 1 of tdisks
set tpath to quoted form of (POSIX path of (tdisk as alias))
set tname to name of tdisk
set treply to button returned of (display dialog "Erase " & tname & "?" buttons {"No", "Yes"} default button "Yes")
end if
end tell
if treply is "Yes" and (count tdisks) = 1 then
do shell script ("rm -rf " & tpath & "*") with administrator privileges
tell application "Finder"
set name of tdisk to "Zip100"
try
eject tdisk
on error
set tdisks to every disk whose name is "Zip100"
if (count tdisks) = 1 then eject (item 1 of tdisks)
end try
end tell
end if
tell application "Finder"
activate
set tcont to button returned of (display dialog "Please insert a new disk and then click continue, or quit." buttons {"Quit", "Continue"} default button "Continue")
end tell
end repeat