• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Deleting Folder Contents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deleting Folder Contents


  • Subject: Re: Deleting Folder Contents
  • From: KOENIG Yvan <email@hidden>
  • Date: Mon, 11 Oct 2010 23:06:50 +0200


Le 11 oct. 2010 à 22:45, Axel Luttgens a écrit :


Le 11 oct. 2010 à 19:47:18, Luther Fuller a écrit :

[...]

On Oct 11, 2010, at 11:52 AM, Axel Luttgens wrote:

Something like this works here:

tell application "System Events"
delete (get disk item "x" of folder "a" of desktop folder)
end tell

I'm trying to delete 'every item' of the folder without inquiring into its name.
I suppose I could get a list of the items in the folder, then delete each item in
a repeat loop. But, it ought to be simpler.

[...]

Then try by specifying more specific classes:

tell application "System Events"
tell folder "a" of desktop folder
delete files
delete folders
end tell
end tell

Class "disk item" often appears too generic for many System Events' operations.

HTH,
Axel


Good point but four added instructions would be useful 

tell application "System Events"
tell folder "a" of desktop folder
try
delete files
end try
try
delete folders
end try
end tell
end tell

Yvan KOENIG (VALLAURIS, France) lundi 11 octobre 2010 23:06:19


 _______________________________________________
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

References: 
 >Deleting Folder Contents (From: Luther Fuller <email@hidden>)
 >Re: Deleting Folder Contents (From: Luther Fuller <email@hidden>)
 >Re: Deleting Folder Contents (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: Deleting Folder Contents
  • Next by Date: Re: Deleting Folder Contents
  • Previous by thread: Re: Deleting Folder Contents
  • Next by thread: Re: Deleting Folder Contents
  • Index(es):
    • Date
    • Thread