Here is my applescript code:
do shell script "ls /Volumes/"
set _Result1 to the paragraphs of result
set sdisk1 to (path to startup disk) as text
set sdisk to text 1 thru -2 of sdisk1
set theFolder to (choose from list _Result with prompt "Choose the drive to install kernel to:" default items sdisk without empty selection allowed)
_Result is equal to a LIST of items in the /Volumes/ folder. What I want to do is, if there is a FILE called “boot” in the list, to remove that item.
Hi,
try this
do shell script "/bin/ls /Volumes/ | /usr/bin/awk !/boot/"
set _Result to the paragraphs of result
set sdisk to boot volume of (system info)
set theFolder to (choose from list _Result with prompt "Choose the drive to install kernel to:" default items {sdisk} without empty selection allowed)
Alternatively:
tell application "System Events"
set diskList to name of disks whose name is not "boot"
end tell
set startupDisk to text 1 thru -2 of (path to startup disk as Unicode text)
choose from list diskList with prompt "Choose the drive to install kernel to:" default items startupDisk
set theFolder to result
if result is false then error number -128 -- cancel
set theFolder to first item of theFolder
Edit:
Wait, only a file? Would a disk called “boot” still be ok?