How to find empty folders?

Started by Gerd, October 07, 2013, 05:09:40 PM

Previous topic - Next topic

Gerd

Hi,

I have deleted a lot pictures (test-pictures) from my category "Test".

How can I now find the empty directorys to delete them?
_______
Regards
Gerd

JohnZeman

#1
The attached script should do it.

Edit: Slightly modified the script so it only searches for empty folders that do not have any subfolders.

[attachment deleted by admin]

BenAW

Otherwise set the "Show Counts" option in the Configure dialog to ON.
Count = 0 indicates an empty folder  :)

Gerd

Thanks , John and Ben,

but this does not help..  ???

If I see the counts = 0, then I have manually to oipen all folder levels and look ...

If I run John's script, a) it allways start with the first drive-letter and not by the actual folder, b) I can do nothing, if a folder is found, only to search for the next ...

Is there no easy possibility to e.g. filter folder via expression for zero content so that I can delete them?
_______
Regards
Gerd

JohnZeman

I don't understand what's happening when you run the script Gerd.  All it should do is to step through all of the folders in your database.  When it finds an empty folder that contains no subfolders it should stop right there at that folder and pop up a message box that gives you the choice to look for more empty folders, or to exit the script so you can work with the empty folder it stopped on.

Gerd

Hi John,

yes, so it is working ... but I have a c: and a h: drive. the c: drive contains a lot of empty folders, that I'm not intersted in, only that on the h: drive are important. Your script starts everytime with the c: drive, so I have to skip manually everytime nearly 50 folders before it comes to the h: drive ...

May be you can change it, that it starts with the actual selected folder ....
_______
Regards
Gerd

JohnZeman

Ok, try the one I've attached to this message instead, it should only search the H: drive.

[attachment deleted by admin]

Gerd

_______
Regards
Gerd

Gerd

Hi John,

thanks again ... it's working fine and helps me a lot!  ;)
_______
Regards
Gerd

JohnZeman

Glad to know it's working for you Gerd. ;D

Gerd

Hi John,

I have modified a little bit ... I took out the yes/no-message-box, so after a <Del> I could so immediately click on the green run-icon, keep my mouse-pointer place there and if a new empty directory was found, directly delete with <Del>-key. So it was only a click-click-action ... very quick done.  ;)
_______
Regards
Gerd

JohnZeman


Mario

Since there is already a hide empty folders feature in the Folder Filter  (under the Media & Folders tree), maybe somebody should add a feature request for a "hide non-empty folders". If checking for empty folders is required often...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook