HI Alfredo,
As a one-line command:
tell application "Finder" to delete file "Macintosh HD:Path:To:File"
(* Classic AppleScript colon-delimited file path. *)
tell application "Finder" to delete POSIX file "/Path/To/File"
(* Unix style slash-delimited path. Assumes internal drive* )
tell application "Finder" to delete POSIX file
"/Volumes/ExternalVolume/Path/To/File"
(* Allows you to specify any volume *)
Allowing more than one command after the "tell"
tell application "Finder"
delete POSIX file "/Volumes/ExternalVolume/Path/To/File"
(* or any of the other delete flavors above *)
end tell
> On Mar 18, 2021, at 10:39 PM, F. Alfredo Rego <[email protected]> wrote:
>
> Hi everyone,
>
> I would like to delete a file via AppleScript.
>
> I’m sure the solution is trivially simple, but so far I can’t find a way.
>
> The easy way would be to do something like this, which sadly does exactly
> what it says and it doesn’t delete the file:
>
> set theFile to (open file "whatever")
> close theFile saving no
>
> I looked around in BBEdit’s dictionary for something naively obvious (perhaps
> "close theFile deleting yes”) but no such luck.
>
>
> I would be thankful for any guidance.
>
>
> Alfredo
>
>
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "[email protected]"
> rather than posting here. Follow @bbedit on Twitter:
> <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/CA8C47EB-6EBC-4D90-891E-8B7746FCDB23%40gmail.com.
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/D38D7962-E918-4C7C-B739-785D6BFE3ECA%40gmail.com.