Results 1 to 16 of 16

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

  1. #1
    Member
    Join Date
    Apr 2010
    Location
    Rome, Italy
    Posts
    282
    Experience
    Advanced
    Primary OS
    Mac 10.8.x Mountain Lion
    Memory
    16 GB
    CPU Cores
    4
    Video Card
    ATI Radeon HD 5750
    LR Version
    4.4
    Camera
    Canon
    File Format
    Raw
    Printer
    Epson

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

    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
    Bob
    -------
    Canon 7D, 5Dmk2 - Canon 17-40L, 50 1.4, 100 macro, 70-200L 2.8 IS

  2. #2
    Lightroom Guru
    Join Date
    Jun 2009
    Location
    Bellaire, TX USA
    Posts
    7,176
    Experience
    Power User
    Primary OS
    Mac 10.9.x Mavericks
    Memory
    16gb
    CPU Cores
    4
    Video Card
    AMD Radeon HD 6770M
    LR Version
    5.5
    Camera
    Nikon D800
    File Format
    Raw
    Printer
    Canon
    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. #3
    Moderator
    Join Date
    Jan 2010
    Location
    West Sussex, UK
    Posts
    6,428
    Experience
    Advanced
    Primary OS
    Windows 7 64-bit
    Memory
    12gb
    CPU Cores
    4
    Video Card
    ATI
    LR Version
    5.5
    Camera
    Canon
    File Format
    Raw
    Printer
    HP
    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.
    Jim

    Desktop: i7-930, 12gb RAM, 2 x SDD, 3 x Internal HDD, Win7 Pro 64bit
    Cameras: 5D MkIII, 7D

  4. #4
    Member
    Join Date
    Apr 2010
    Location
    Rome, Italy
    Posts
    282
    Experience
    Advanced
    Primary OS
    Mac 10.8.x Mountain Lion
    Memory
    16 GB
    CPU Cores
    4
    Video Card
    ATI Radeon HD 5750
    LR Version
    4.4
    Camera
    Canon
    File Format
    Raw
    Printer
    Epson
    Thanks Clee and Jim. I would have done just what you're saying but had hoped for a less labor intensive approach :-)
    Bob
    -------
    Canon 7D, 5Dmk2 - Canon 17-40L, 50 1.4, 100 macro, 70-200L 2.8 IS

  5. #5
    Member
    Join Date
    Jun 2010
    Location
    Kiev, Ukraine
    Posts
    140
    Experience
    Advanced
    Primary OS
    Mac 10.8.x Mountain Lion
    Memory
    8gb
    CPU Cores
    2
    Video Card
    AMD Radeon HD 6630M 256 MB
    LR Version
    5.0
    Camera
    Nikon
    File Format
    Raw
    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 by Karayuschij; 1 May 2012 at 2:35 am.

  6. #6
    Lightroom Guru
    Join Date
    Jun 2009
    Location
    Bellaire, TX USA
    Posts
    7,176
    Experience
    Power User
    Primary OS
    Mac 10.9.x Mavericks
    Memory
    16gb
    CPU Cores
    4
    Video Card
    AMD Radeon HD 6770M
    LR Version
    5.5
    Camera
    Nikon D800
    File Format
    Raw
    Printer
    Canon
    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. #7
    Member
    Join Date
    Apr 2010
    Location
    Rome, Italy
    Posts
    282
    Experience
    Advanced
    Primary OS
    Mac 10.8.x Mountain Lion
    Memory
    16 GB
    CPU Cores
    4
    Video Card
    ATI Radeon HD 5750
    LR Version
    4.4
    Camera
    Canon
    File Format
    Raw
    Printer
    Epson
    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
    -------
    Canon 7D, 5Dmk2 - Canon 17-40L, 50 1.4, 100 macro, 70-200L 2.8 IS

  8. #8
    Moderator
    Join Date
    Jan 2010
    Location
    West Sussex, UK
    Posts
    6,428
    Experience
    Advanced
    Primary OS
    Windows 7 64-bit
    Memory
    12gb
    CPU Cores
    4
    Video Card
    ATI
    LR Version
    5.5
    Camera
    Canon
    File Format
    Raw
    Printer
    HP
    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

    Desktop: i7-930, 12gb RAM, 2 x SDD, 3 x Internal HDD, Win7 Pro 64bit
    Cameras: 5D MkIII, 7D

  9. #9
    Member
    Join Date
    Apr 2010
    Location
    Rome, Italy
    Posts
    282
    Experience
    Advanced
    Primary OS
    Mac 10.8.x Mountain Lion
    Memory
    16 GB
    CPU Cores
    4
    Video Card
    ATI Radeon HD 5750
    LR Version
    4.4
    Camera
    Canon
    File Format
    Raw
    Printer
    Epson
    Jim you convinced me ! ;-)
    Bob
    -------
    Canon 7D, 5Dmk2 - Canon 17-40L, 50 1.4, 100 macro, 70-200L 2.8 IS

  10. #10
    Lightroom Guru
    Join Date
    Jun 2009
    Location
    Bellaire, TX USA
    Posts
    7,176
    Experience
    Power User
    Primary OS
    Mac 10.9.x Mavericks
    Memory
    16gb
    CPU Cores
    4
    Video Card
    AMD Radeon HD 6770M
    LR Version
    5.5
    Camera
    Nikon D800
    File Format
    Raw
    Printer
    Canon
    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. #11
    Member
    Join Date
    Jun 2010
    Location
    Kiev, Ukraine
    Posts
    140
    Experience
    Advanced
    Primary OS
    Mac 10.8.x Mountain Lion
    Memory
    8gb
    CPU Cores
    2
    Video Card
    AMD Radeon HD 6630M 256 MB
    LR Version
    5.0
    Camera
    Nikon
    File Format
    Raw
    Quote Originally Posted by clee01l View Post
    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].

    Quote Originally Posted by clee01l View Post
    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"?

    Quote Originally Posted by clee01l View Post
    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.

  12. #12
    Lightroom Guru
    Join Date
    Jun 2009
    Location
    Bellaire, TX USA
    Posts
    7,176
    Experience
    Power User
    Primary OS
    Mac 10.9.x Mavericks
    Memory
    16gb
    CPU Cores
    4
    Video Card
    AMD Radeon HD 6770M
    LR Version
    5.5
    Camera
    Nikon D800
    File Format
    Raw
    Printer
    Canon
    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. #13
    Member
    Join Date
    Jun 2010
    Location
    Kiev, Ukraine
    Posts
    140
    Experience
    Advanced
    Primary OS
    Mac 10.8.x Mountain Lion
    Memory
    8gb
    CPU Cores
    2
    Video Card
    AMD Radeon HD 6630M 256 MB
    LR Version
    5.0
    Camera
    Nikon
    File Format
    Raw
    ^ 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 by Karayuschij; 1 May 2012 at 11:23 am.

  14. #14
    Member
    Join Date
    Apr 2010
    Location
    Rome, Italy
    Posts
    282
    Experience
    Advanced
    Primary OS
    Mac 10.8.x Mountain Lion
    Memory
    16 GB
    CPU Cores
    4
    Video Card
    ATI Radeon HD 5750
    LR Version
    4.4
    Camera
    Canon
    File Format
    Raw
    Printer
    Epson
    Karayuschi the point is that LR is a database and not a "filesystem browser" :-)
    Bob
    -------
    Canon 7D, 5Dmk2 - Canon 17-40L, 50 1.4, 100 macro, 70-200L 2.8 IS

  15. #15
    New Member
    Join Date
    Jun 2014
    Posts
    1
    Experience
    Advanced
    Primary OS
    Windows 8 64-bit
    LR Version
    4.4
    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
    cd "your folder path here, including the quotes"
    4. now type the command
    find . -type d -empty -delete
    I got my solution from here: http://unix.stackexchange.com/questi...home-directory

  16. #16
    Junior Member
    Join Date
    Jun 2014
    Location
    Currently Lausanne, CH
    Posts
    37
    Experience
    Intermediate
    Primary OS
    Mac 10.9.x Mavericks
    Memory
    8gb
    CPU Cores
    2
    LR Version
    5.5
    Camera
    Nikon D600
    File Format
    Raw+Jpeg
    Printer
    None
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •