Format a disk on MacOS X

Ludovic Thébault ludovic.thebault at
Fri Feb 6 05:16:42 EST 2009


I want to make a button to format a disk with the shell (in FAT16  
which is impossible to do with the GUI of MacoS X).
Here my script :

   get shell("df")
   put line lineoffset("/Volumes/"&the label of btn "disk", it) of it  
into tdisk
   set the itemdel to " "
   put item 1 of tdisk into tdisk
-- return /dev/Disks4s1
   get shell("diskutil umount "&tdisk)
  -- Fail to unmount (but works directly in the terminal)
   get shell("diskutil partitionDisk "&tdisk&" 1 MBRFormat "&quote&"MS- 
DOS FAT16"&quote&&quote&fld "newname"&quote&&"100%")
-- don't work because the disk is always mounted

Any idea ?


More information about the Use-livecode mailing list