1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Welcome to Lightroom Forums! We're a friendly bunch, so please feel free to register and join in the conversation. If you're not familiar with forums, you'll find step by step instructions on how to register and post your first thread under Help on the menubar above. You're also welcome to join our newsletter, download our free Lightroom Quick Start eBook and explore our other FAQ resources.
    Dismiss Notice

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

Discussion in 'Managing your Photos & Video' started by rjalex, Apr 30, 2012.

  1. rjalex

    rjalex Active Member

    Joined:
    Apr 21, 2010
    Messages:
    292
    Location:
    Rome, Italy
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.5 / CC 2015.5
    Lightroom License:
    Perpetual License
    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
     
  2. clee01l

    clee01l Lightroom Guru Staff Member Lightroom Guru

    Joined:
    Jun 20, 2009
    Messages:
    11,075
    Location:
    Bellaire, TX USA
    Lightroom Experience:
    Power User
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.6 / CC 2015.6
    Lightroom License:
    CC Subscription
    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.
     
  3. Jim Wilde

    Jim Wilde Lightroom Guru Staff Member Moderator Lightroom Guru

    Joined:
    Feb 1, 2010
    Messages:
    9,313
    Location:
    West Sussex, UK
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.6 / CC 2015.6
    Lightroom License:
    CC Subscription
    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.
     
  4. rjalex

    rjalex Active Member

    Joined:
    Apr 21, 2010
    Messages:
    292
    Location:
    Rome, Italy
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.5 / CC 2015.5
    Lightroom License:
    Perpetual License
    Thanks Clee and Jim. I would have done just what you're saying but had hoped for a less labor intensive approach :)
     
  5. Karayuschij

    Karayuschij Active Member

    Joined:
    Jun 11, 2010
    Messages:
    143
    Location:
    Kiev, Ukraine
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.8.x Mountain Lion
    Lightroom Version:
    5.0
    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: May 1, 2012
  6. clee01l

    clee01l Lightroom Guru Staff Member Lightroom Guru

    Joined:
    Jun 20, 2009
    Messages:
    11,075
    Location:
    Bellaire, TX USA
    Lightroom Experience:
    Power User
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.6 / CC 2015.6
    Lightroom License:
    CC Subscription
    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.
     
  7. rjalex

    rjalex Active Member

    Joined:
    Apr 21, 2010
    Messages:
    292
    Location:
    Rome, Italy
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.5 / CC 2015.5
    Lightroom License:
    Perpetual License
    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 ?
     
  8. Jim Wilde

    Jim Wilde Lightroom Guru Staff Member Moderator Lightroom Guru

    Joined:
    Feb 1, 2010
    Messages:
    9,313
    Location:
    West Sussex, UK
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.6 / CC 2015.6
    Lightroom License:
    CC Subscription
    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).....
     
  9. rjalex

    rjalex Active Member

    Joined:
    Apr 21, 2010
    Messages:
    292
    Location:
    Rome, Italy
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.5 / CC 2015.5
    Lightroom License:
    Perpetual License
    Jim you convinced me ! ;)
     
  10. clee01l

    clee01l Lightroom Guru Staff Member Lightroom Guru

    Joined:
    Jun 20, 2009
    Messages:
    11,075
    Location:
    Bellaire, TX USA
    Lightroom Experience:
    Power User
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.6 / CC 2015.6
    Lightroom License:
    CC Subscription
    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.
     
  11. Karayuschij

    Karayuschij Active Member

    Joined:
    Jun 11, 2010
    Messages:
    143
    Location:
    Kiev, Ukraine
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.8.x Mountain Lion
    Lightroom Version:
    5.0
    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].

    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"?

    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.
     
  12. clee01l

    clee01l Lightroom Guru Staff Member Lightroom Guru

    Joined:
    Jun 20, 2009
    Messages:
    11,075
    Location:
    Bellaire, TX USA
    Lightroom Experience:
    Power User
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.6 / CC 2015.6
    Lightroom License:
    CC Subscription
    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.
     
  13. Karayuschij

    Karayuschij Active Member

    Joined:
    Jun 11, 2010
    Messages:
    143
    Location:
    Kiev, Ukraine
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.8.x Mountain Lion
    Lightroom Version:
    5.0
    ^ 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: May 1, 2012
  14. rjalex

    rjalex Active Member

    Joined:
    Apr 21, 2010
    Messages:
    292
    Location:
    Rome, Italy
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.11.x El Capitan
    Lightroom Version:
    6.5 / CC 2015.5
    Lightroom License:
    Perpetual License
    Karayuschi the point is that LR is a database and not a "filesystem browser" :)
     
  15. AMDphreak

    AMDphreak New Member

    Joined:
    Jun 23, 2014
    Messages:
    1
    Lightroom Experience:
    Advanced
    Primary OS:
    Windows 8 64-bit
    Yes there is a way.

    1. Locate your picture catalog's top folder and copy the path (example: /Users/username/Pictures/).
    2. Open up Terminal.
    3. type the command
    4. now type the command
    I got my solution from here: http://unix.stackexchange.com/quest...delete-empty-directories-in-my-home-directory
     
  16. kolesoff

    kolesoff New Member

    Joined:
    Jun 10, 2014
    Messages:
    58
    Location:
    Currently Lausanne, CH
    Lightroom Experience:
    Advanced
    Primary OS:
    Mac 10.10.x Yosemite
    Lightroom Version:
    5.7
    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.
     

Share This Page