A function that can be used in Scripting.
The file is opened for writing, then closed (if the file already existed, it is emptied!).
Upon success (i.e. the file already existed and was successfully emptied, or the file didn’t exist yet but was successfully created), this function returns 1 (true). Otherwise, the function returns 0 (false); this can happen if the folder in the path does not exist, or if the file is (or would be) on a read-only device.
For instance, if my TIMIT database is in a read-only disk image called
TIMIT.dmg, and I mounted that disk image on my Mac (by double-clicking
TIMIT.dmg), then trying
would return 0.
For a non-destructive version of this function, see
© Paul Boersma 2023