trashLocalFolderIfExists
April 23, 2008 in Mac OS X by chip
Apparently there is no way to do this on Windows- even from the shell!
But here’s the OS X version:
FUNCTION trashLocalFolderIfExists tPathAndFile
IF there is a folder tPathAndFile THEN
set the itemdel to "/"
put the last item of tPathAndFile into tFolderName
rename folder tPathAndFile to specialfolderpath("trsh") & "/" & tFolderName --! need Win32 switch
IF the result is not empty THEN
return "Got an error while trying to delete" && tPathAndFile & ":" && the result
END IF
ELSE
return "HEELP! Went to delete a folder that wasn't there:" && tPathAndFile
END IF
END trashLocalFolderIfExists