Welcome to MacBoardz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Deleting empty folders

 
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  Suggestions wanted - USB 2.0 card for G4 Sawtooth  
Author Message
Pat O'Halloran

External


Since: Dec 29, 2008
Posts: 2



(Msg. 1) Posted: Mon Dec 29, 2008 2:28 pm
Post subject: Deleting empty folders
Archived from groups: alt>comp>lang>applescript (more info?)

Hi

I'm a complete beginner with scripting, even after several years of
trying, so I wondered if anyone can help?

I would like a script that checks a folder for any empty sub-folders and
then moves those sub-folders to the trash. I feel it should be simple
but I can't seem to get anything working.

Any help appreciated.

Cheers

 >> Stay informed about: Deleting empty folders 
Back to top
Login to vote
Michelle Steiner

External


Since: Jul 15, 2003
Posts: 3627



(Msg. 2) Posted: Mon Dec 29, 2008 2:28 pm
Post subject: Re: Deleting empty folders [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

This message is not archived

 >> Stay informed about: Deleting empty folders 
Back to top
Login to vote
Pat O'Halloran

External


Since: Dec 29, 2008
Posts: 2



(Msg. 3) Posted: Tue Dec 30, 2008 12:26 pm
Post subject: Re: Deleting empty folders [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Michelle Steiner wrote:

> In article ,
> kelpie.DeleteThis@danu.co.uk (Pat O'Halloran) wrote:
>
> > I would like a script that checks a folder for any empty sub-folders
> > and then moves those sub-folders to the trash. I feel it should be
> > simple but I can't seem to get anything working
>
> This is a matter of recursion.
>
> set topLevel to choose folder
> traverseFolders(topLevel)
> on traverseFolders(inputFolder)
> tell application "Finder"
> set FolderList to folders of inputFolder
> repeat with thisFolder in FolderList
> if items of thisFolder is {} then
> delete thisFolder
> else
> my traverseFolders(thisFolder)
> end if
> end repeat
> end tell
> end traverseFolders
>
> One flaw in this script, though, is that if a folder's contents is only
> one or more empty folders, it will empty that folder, which will then
> become empty, but will not not empty those folders.
>
> -- Michelle

Thank you, I'll try that.
 >> Stay informed about: Deleting empty folders 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Script to check empty folder and swap files - I'm not exactly sure where to begin with this script. Here's what I'd like it to accomplish, maybe I can get some input as to how to compile it? --I've got an application that I want to be able to use either preference set A with or preference set B with...

Deleting data item from data source - Hi I have a data source attached to an outline view in Applescript Studio. If I want to delete a data item, it seems to work fine when I just delete a data item which I have refered to directly (ie when it is the selected item) but when I iterate..

recurse folders - [OS = 10.3.5] I'm sure this is simple when you know how. I need to add an extension (suffix) to files for x-platform use. so far so good. however, I need to recurse sub folders and am getting stuck. None of my book or online references seem to cover..

Copy folders to server - I thought it would be easy, but I can't find an example script for copying a folder (files and folders nested within) to a server. Don't have to worry about synchronizing, just want to copy the entire folder from a local Volume to a server. -marty

Acessing Mac OS X special folders? - Can anyone help - this seems like it should be a stupid question but... How can I easily determine the path of OS X special folders such as Documents for network users? I can get some folders with "path to preferences folder from user domain&quo...
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]