Page 2 of 3

Posted: Thu May 29, 2008 6:14 pm
by MoDementia
Hahahaha, its skipping most of the folders in the log :)

Code updated: Includes confirmation on all deletes

Posted: Fri May 30, 2008 1:06 am
by Kilmatead
This is me being thick again. Sorry. :oops: Still complaining about permissions - whilst it is only too happy to delete it's own log now (before I can check it), nothing else is deleted. Must not be reading the names off the log correctly, as it never even gets to the confirmation bit.

Has VB always been this arcane to debug, or does MM just have a "One Size Fits All" scripting error policy? Odd.

Posted: Fri May 30, 2008 2:06 pm
by Kilmatead
Ok, I've been digging. Let's see. Say my music folder is 'C:\Users\Kilmatead\Music':

In 'Sub DeleteFolders()'

Code: Select all

       If yCounter > 1 Then
         Set FolderProperties = FSO.GetFolder(Folder)
is causing the "Permissions" error as when yCounter = 2 it's trying to get the properties of the main User Account Folder (Kilmatead) - and it terminates - apparently this is a no-no, as any other folder check works fine ('Users' or 'Music'). Obviously the simple solution is just If yCount > 2 instead of 1 - but this might cause problems for people who keep their music on a drive other than C:.

My question is, exactly why did you create DeleteFolders() to parse out tmpArray at all? It seems to me as MoveDeleteFolders() already contains the necessary target in the Folder string - it could just do the existence check, size check, and kill it if it's truly evil.

Or am I missing something?

Or, indeed, if it must parse it, shouldn't it be parsing backwards from the innermost children to the parent, instead of parent to child?

Mustn't we all seek our own innermost child? :D

Posted: Fri May 30, 2008 4:13 pm
by MoDementia
Cheers, code was in use in another script i.e. not rewritten for this specific application.

Updated code in the original post.

Posted: Fri May 30, 2008 11:40 pm
by dreadlyone
Great script. Thanks for putting this together...

In the script, on line 27,

Code: Select all

StartFolder = "X:\My Music"          '<--- Search for Folders from here down.
Can I list Multiple folders here and if so, what would be the proper format?

I have music on multiple drives. 3 to be exact.

Posted: Sat May 31, 2008 12:18 am
by MoDementia
Sorry, you will have to run it 3 times

Posted: Sat May 31, 2008 3:43 am
by Kilmatead
Actually, seeing as it doesn't recursively reduce emptied folders, you might have to run it upwards of 9 times (3 on each collection) to be sure to get all the little buggers.

I was thinking this could be automated, but the deletion confirmation makes this more complex than necessary for such a simple task (anything denied removal would just come up again, or need to be cached so it's not queried twice or thrice), so it's easier to just re-run it.

But, how or never. Thank you again MoDementia.

Tool 'Remove Empty Directories'

Posted: Sat May 31, 2008 4:33 am
by callmetom
I use the free tool 'Remove Empty Directories':

You can configure there what means 'empty Directory'.
It works very well and has also optionally shell integration.

You need to execute it with 'admin rights'.

You can find it here (along with screenshots):

http://www.jonasjohn.de/lab/red.htm

System Requirements
Microsoft .NET Framework 2.0
(The installer should check if you have installed the .NET Framework 2.0 and will install it if not)

License

RED is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

Posted: Sat May 31, 2008 4:50 am
by Kilmatead
Well that takes all the fun out of it. :D

Posted: Sat May 31, 2008 4:58 am
by callmetom
Kilmatead wrote:Well that takes all the fun out of it. :D
Yeah i know :-? - but thats the way it should work.

Meanwhile i use this tool :lol:

Take it as a hint for more features to come :wink:

Posted: Sat May 31, 2008 6:14 am
by Kilmatead
callmetom wrote:Yeah i know :-? - but thats the way it should work.
The script, however, is still better suited to MM's proclivities as it preserves the .png/.jpg files (as a backup in case you really wanted the album-art) before removing the folders.

So all is not lost for the little guy reinventing the wheel! :D

RED, though, is certainly very useful "in the bigger picture." Thanks.

Posted: Sat May 31, 2008 12:50 pm
by dreadlyone
Ya, I had already went through the process of running it multiple times on each drive before posting and I managed to clean up quite a bit of left over folders with just album art. Thought I would ask anyways.

I love the script :D. I am a happy camper.

Finding Empty Folders

Posted: Wed Jun 04, 2008 11:35 pm
by SouthernGal
I have been using "RED version 2.1.0.0" (free program...just google) and I'm tickled to death with it. I'm using it with Vista Ultimate in compatibility mode as administrator with no problems and 100% success. It will batch process and find empty folders and/or nearly empty folders containing only the criteria you define (such as album art)..........then you can delete them with the push of one button. Has saved me hours!

Re: Finding Empty Folders

Posted: Thu Jun 05, 2008 2:02 pm
by callmetom
SouthernGal wrote:I have been using "RED version 2.1.0.0" (free program...just google) and I'm tickled to death with it. I'm using it with Vista Ultimate in compatibility mode as administrator with no problems and 100% success. It will batch process and find empty folders and/or nearly empty folders containing only the criteria you define (such as album art)..........then you can delete them with the push of one button. Has saved me hours!
I post this tool a few posts before ?

Posted: Thu Jun 05, 2008 2:12 pm
by Kilmatead
Maybe she's a fan of yours?

Some people like to respond to topics before reading the actual content. Rather like if the headline were "God Is Dead and The War Has Begun" - the appropriate response would "obviously" be "Anything special happening today?"

Humans on the internet are weird. :wink: