Deleting Empty Folders (yeah, I know, I know...)
-
- Posts: 1321
- Joined: Thu Jun 15, 2006 3:26 pm
- Location: Geelong, Victoria, Australia
This is me being thick again. Sorry. 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.
Has VB always been this arcane to debug, or does MM just have a "One Size Fits All" scripting error policy? Odd.
Ok, I've been digging. Let's see. Say my music folder is 'C:\Users\Kilmatead\Music':
In 'Sub DeleteFolders()'
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?
In 'Sub DeleteFolders()'
Code: Select all
If yCounter > 1 Then
Set FolderProperties = FSO.GetFolder(Folder)
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?
-
- Posts: 1321
- Joined: Thu Jun 15, 2006 3:26 pm
- Location: Geelong, Victoria, Australia
-
- Posts: 48
- Joined: Mon Jan 07, 2008 2:06 pm
Great script. Thanks for putting this together...
In the script, on line 27,
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.
In the script, on line 27,
Code: Select all
StartFolder = "X:\My Music" '<--- Search for Folders from here down.
I have music on multiple drives. 3 to be exact.
-
- Posts: 1321
- Joined: Thu Jun 15, 2006 3:26 pm
- Location: Geelong, Victoria, Australia
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.
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'
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.
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.
My Specs:
Windows XP / SP2
Always latest MM version
Sorry for my sometimes bad english (-:
Windows XP / SP2
Always latest MM version
Sorry for my sometimes bad english (-:
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.callmetom wrote:Yeah i know - but thats the way it should work.
So all is not lost for the little guy reinventing the wheel!
RED, though, is certainly very useful "in the bigger picture." Thanks.
-
- Posts: 48
- Joined: Mon Jan 07, 2008 2:06 pm
-
- Posts: 16
- Joined: Sat Mar 29, 2008 5:55 am
Finding Empty Folders
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
I post this tool a few posts before ?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!
My Specs:
Windows XP / SP2
Always latest MM version
Sorry for my sometimes bad english (-:
Windows XP / SP2
Always latest MM version
Sorry for my sometimes bad english (-: