Is there a way to delete all folders with 0 photos ?

Status
Not open for further replies.

rjalex

Active Member
Joined
Apr 21, 2010
Messages
321
Location
Rome, Italy
Lightroom Experience
Advanced
Lightroom Version
After a major restructuring of my library I ended up with around 100 folders which contain 0 photos neatly intermingled with ones that have photos in them,

Is there a way to automate the process of removing all these empty folders ?

Thanks
 
Not a quick one-step method I'm afraid, but close. If the folders are truly empty and not just containing no cataloged images they will be removed from both the LR folder panel and the underlying OS file sytem. If they still contain uncataloged files not referenced by LR, they will be removed from the catalog only

In the folder panel, with the file counts showing expand all folders. Select each folder showing "0" images by holding down the {Shift} key to select a block or the {Cmd} key to select multiple individual folders. With all of your selected folders, right click and choose {Remove} from the context menu.
 
Can't think of an automated method.

If you Alt-click on your parent folder(s) that will expand your entire folder tree (may have to do it twice as it's a toggle: collapse then expand). Then just work your way down the list to control-click on each empty folder, then when done right-click and select remove.

Just make sure that:

a) You have "Show Photos in Subfolders" checked, else you might mistake a parent folder for an empty sub-folder.
b) You take care to select only empty folders. If you inadvertently select a folder that does contain photos, when you select "Remove" you should get a warning dialog that you are about to remove folders containing xx photos. If you receive that, cancel and look back to see where you went wrong.
 
Thanks Clee and Jim. I would have done just what you're saying but had hoped for a less labor intensive approach :)
 
What will happen if you trash the folders directly from the finder (ordered by size before to have all empty folders grouped at the top or the bottom of the window) and then do something like synchronize the top folder of your LR Library?
Try with one or two folders before. I think that if it does not work you will not have problem, if it don't work you will just get folders with an "?" in your library… (as they say in Rome: "tentar non nuoce" ;) )
(Or synchronize find only missing images in Library and don't remove empty folders?)
 
Last edited:
Karayuschij, If you delete an empty folder from the folder panel, it is gone from the underlying file system too. There can be no issues with this. If there are other files in the folder or even image files in the folder, LR will only remove the folder from the catalog. The folder will remain on the HD. If such a folder exists on the file system after being removed from the catalog, synchronizing the parent folder will show and catalog the folder only if there are image files in it.
 
So Cletus what about deleting ALL folders from within LR, so that the 0 files will get deleted from the underlying filesystem too and then "Adding" back all remaining folders from the filesystem. Would I lose anything in the process ?
 
Bob, are you serious? Removing 100 empty folders would take what, 20 minutes? Less in fact as you can multi-select then do one remove operation. OTOH, doing it by removing ALL folders then adding back in the non-empty ones would be a re-import job which is going to take much longer, AND you'd have to ensure you did a Ctrl+S first to ensure your metadata was written to the files, AND you'd lose all develop history and collection membership (plus some other stuff).....
 
Jim you convinced me ! ;-)
 
Removing 100 empty folders using the multiple select option should take far far less than 20 min. (Which BTW was outlined in my initial reply). Removing them one at a time would take much less than the time spent discussing this issue if you had started when I first posted a reply to the query.
 
Karayuschij, If you delete an empty folder from the folder panel, it is gone from the underlying file system too. There can be no issues with this.

From the Finder window you can order the folders by size (in Lightroom you can't - or I don't know how to do it), so in this way you will have all the empty folders at the top or the bottom of the list and then be able to select them with two clicks, and then put them all in the trash with one keyboard shortcut [cmd + back].

If there are other files in the folder or even image files in the folder, LR will only remove the folder from the catalog.

I have understood that rjalex was speaking about empty folders ("Is there a way to automate the process of removing all these empty folders ?"), so why you tell "If there are other files in the folder"?

synchronizing the parent folder will show and catalog the folder only if there are image files in it.

So if it is like this you just have to synchronize the parent folder in the library and the empty folders will disappear automatically [?]
So why to remove the empty folders manually?
Sorry, I don't understand well this point

Btw, yes select 100 folders, one at a time from Lightroom is a 10 minutes work.
 
Bob's question about "empty folders" is in reference to folders in the LR folder panel that show 0 images. Showing zero images is not the same as a folder that has no images or other files as seen in finder. The zero image count as seen in the folder panel only means that the catalog has zero images cataloged for that folder. When deleting from the folder panel, LR is smart enough to remove folders that are truly empty from both the catalog and from the file system. If ther are files in the folder when the user removes the folder from the catalog, LR does not delete the folder from the file system, since the folder contains other (possibly important and probably non image) files.
By deleting truly empty folders from the file system using Finder and then having to remove them from LR as an additional step is not very efficient. If the user is careful and never adds files to the folders managed by LR except through LR, then it is sufficient to remove folders from the LR Catalog and delete them from the file system in one step. If the user does through ignorance or neglect add files to folders managed by LR, then LR will only remove the folder from LR management and protect the users files from their own stupidity.
 
^ Okay Cletus, it is all clear now.
In fact I don't completely agree with the way to count of Lightroom.
I think that it would be better (more clear) to have 2 numbers, for example "10 (12)" : the first indicating the number imported in the library and the second the number of images contained in the original folder (system).
And personally I always prefer to have a full backup of everything before to do any operation like deleting or removing folders in large quantity.

Thank you
 
Last edited:
Karayuschi the point is that LR is a database and not a "filesystem browser" :)
 
What I would suggest, to be on the safe side:
1. Create special folder inside LR called "0 files" or something identifiadle.
2. Drag all the folders which contain 0 lightroom-managed files into that folder from within lightroom.
3. Go ahead to check the real emptiness of the folders to be deleted via Finder, ForkLift or anything else.
4. If you have no files there that you want to keep, or all the folders are really zero, delete them from lightroom.
5. The folders that have something will still be on your HDD, not spread over your entire file system but in one location where you can easily find them. So you can manually delete the remains of "0 files" folder with the folder itself.

If you don't care at all about the files that may be left over in these 0-folders, skip step 3. On step 5 just delete "0 files" with all included subfolders :)

The most time-consuming part is to select all the empty folders, which will take you for 100 folders around I would say 3–5 min.
 
Status
Not open for further replies.
Back
Top