Re: Simply deleting a fil
Re: Simply deleting a fil
- Subject: Re: Simply deleting a fil
- From: Tim Mansour <email@hidden>
- Date: Fri, 17 Apr 2009 20:48:31 +1000
2009/4/17 Sutapalli Satyanarayana <email@hidden>:
> Can we add some check like "if __MACOSX exists then delete" and combine with
> this statement.
You can use something like this:
tell application "Finder"
set file_path to ((path to documents folder as text) & "__MACOSX")
if exists folder file_path then delete folder file_path
end tell
Or you could use a "try" statement to trap any error:
tell application "Finder"
try
delete folder ((path to documents folder as text) & "__MACOSX")
on error
-- do something else if required
end try
end tell
Also, as Yvan has kindly pointed out ... using the Finder "delete"
command places the item in the Trash. If you want to delete without
using the Trash you can tell "System Events" instead. Or you could use
the shell "rm" command as suggested by Skeeve.
--
Tim Mansour
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden