Deleting Empty Folders (yeah, I know, I know...)

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Kilmatead
Posts: 206
Joined: Mon Apr 07, 2008 2:16 pm
Location: Dublin

Deleting Empty Folders (yeah, I know, I know...)

Post by Kilmatead »

Apparently whenever someone mentions they're having troubles with leftover empty folders (after deleting/moving albums) there ensues a litany of the usual "Are you sure they're really empty?" to the obvious "Tick Delete This-folder/Delete That-folder Box", or my personal favourite "Didn't they fix that? I haven't had that problem since they shot General Anwar Sadat."

Ok, let's just say I'm not having this problem. Really, don't worry about it. Oh look, pretty birds. (Distraction technique.)

Now, were someone to offer me directions to a script that would happily "Clean" my library of all empty folders (or even 'nearly' empty folders with only album-art remaining) I would leave the gun and take the cannoli, as it were. No questions asked, no thanks given (so men can men, and unknown tough guys can ride into sunsets anew).

I think this would be a nice solution to a most notorious problem that doesn't really exist.

Nothing fancy, just a recursive snooper nip and tuck for \Music\

Cheers. :wink:
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

backup tracks has some code to delete empty directories which should be easy enough to extract and modify

as for "nearly" empty directories its a tad more difficult but I might give it a go in a week or 2.
Kilmatead
Posts: 206
Joined: Mon Apr 07, 2008 2:16 pm
Location: Dublin

Post by Kilmatead »

MoDementia wrote:...as for "nearly" empty directories its a tad more difficult but I might give it a go in a week or 2.
Those swamped with lonely 'folder.jpg's appreciate your existence.
dreifach
Posts: 13
Joined: Sat Jan 19, 2008 9:27 am
Location: Ohio, US

Post by dreifach »

I use EmptyFolderNuker for this purpose. It's lightweight, and it can delete empty folders recursively.
Why don't car stereos come with WiFi enabled hard disk drives? Treat them just like a portable device and sync them while they're parked in the garage!
dreadlyone
Posts: 48
Joined: Mon Jan 07, 2008 2:06 pm

Post by dreadlyone »

If anyone finds an app that can delete almost empty folders or some type of setup to allow for conditions, I offer my first born child as payment.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

No Longer Available
Last edited by MoDementia on Tue Feb 03, 2009 4:31 am, edited 6 times in total.
Kilmatead
Posts: 206
Joined: Mon Apr 07, 2008 2:16 pm
Location: Dublin

Post by Kilmatead »

Very much appreciated - and I like the caveat. Will take some time to figure out...

First born proved somewhat unreliable (as they do). Second born posted surface mail. Will require feeding upon arrival. :D
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Couple of points...

1) A progress bar would be lovely! :)

2) It is marking any folder which does not contain files, but which does contain a folder which contains files, as "nearly empty". These are not nearly empty, it just means I don't have any non-album tracks by this artist.

Nice script though! :D
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

New I forgot something.

Nearly Empty Folders must have at least 1 file in them
If they only have folders it does nothing.

But I think there might be a problem / error if you have this situation

C:\My Music\aaa
C:\My Music\aaa\bbb.jpg
C:\My Music\aaa\ccc
C:\My Music\aaa\ccc\ddd.mp3

Folder C:\My Music\aaa will be seen as a Nearly Empty Folder
But I don't think it can be deleted because of C:\My Music\aaa\ccc is still there

Can't check it till tomorrow now though :(
Retribution
Posts: 11
Joined: Wed May 21, 2008 9:05 pm

Post by Retribution »

whenever i try to run the script i get error message #76. i dont know what's wrong, i copied the script and added the necessary things to the scripts.ini file and i created the folder the script says to create. btw it's line 29 column 2 and it says that the path can not be found...


do i need to change the D:\My Music to my drive letter?
Kilmatead
Posts: 206
Joined: Mon Apr 07, 2008 2:16 pm
Location: Dublin

Post by Kilmatead »

Retribution wrote:do i need to change the D:\My Music to my drive letter?
Yes, your driver letter, and music folder (say, in Vista "C:\Users\...\Music", in lieu of "\My Music").

Be aware there's no message as to when the script is done, so just wait a bit and check your NearlyEmptyCrap folder for the log.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

Updated the code a little.
Progress bar and the tricky Nearly Empty scenario.

@Retribution
Unless you can read and understand this script enough to make it work for you specific requirements DON'T USE IT.

Yes you need to change lines 26, 27 and 62 to suit.
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

And a Finished message :P
Retribution
Posts: 11
Joined: Wed May 21, 2008 9:05 pm

Post by Retribution »

MoDementia wrote:Updated the code a little.
Progress bar and the tricky Nearly Empty scenario.

@Retribution
Unless you can read and understand this script enough to make it work for you specific requirements DON'T USE IT.

Yes you need to change lines 26, 27 and 62 to suit.

while i dont understand the script, i have a pretty good knowledge of computers. obviously i had an idea on what needed to be done by asking if i needed to change the drive letter. you could've just helped me instead of being an ***
Kilmatead
Posts: 206
Joined: Mon Apr 07, 2008 2:16 pm
Location: Dublin

Post by Kilmatead »

MoDementia wrote:And a Finished message :P
You've gotta love how Aussies live in the future. Your "tomorrow" is still my today. Convenient, that. Lotto numbers next, please.

While we're on the subject of silly little suggestions, perhaps some sort of line-by-line "Kill Folder <x> Yes/No" might be nice, for semi-automation, but I understand why that part's not developed just yet.

I would play with these things myself, but I never learned VB... it hadn't been invented yet, so I learned C, Pascal and even Ada (:o) instead. Take me a little while to adjust, but the "gist" is clear. Did have a slight bit of difficulty getting 'Call MoveDeleteFolders(EmptyFolderList,MoveToFolder, Progress)' to work though... kept waffling about permissions. (I was experimenting in a quarantined milieux, in case you think me rash.)
Post Reply