Can't find empty folders using Windows Explorer search function

Page 1 of 2 12 LastLast

  1. Posts : 141
    Win 10
       #1

    Can't find empty folders using Windows Explorer search function


    I'm trying to find all folders that are empty. Within Windows Explorer I select the folder, which contains a number of sub-folders. Click in the search box which then brings up the search options at the top of the window. I select All Subfolders; Type as Folders: Size as Empty, which puts into the search box the following statement:-

    kind:=folder size:empty

    It then goes through the motions of searching but doesn't produce any results and I know for a fact there are several empty folders, some of which I specifically made to test this function.

    Any thoughts on what I'm doing wrong or does it just not work.

    Many thanks
      My Computer


  2. Posts : 42,991
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Hi, this apparently used to...
    How do I find all the empty folders and delete them. - Microsoft Community

    but not 'now' (I'm on build 1709)

    Other size specifications (non-zero) appear to work.

    There are 3rd party tools:
    7 Tools To Find And Delete Empty Folders in Windows • Raymond.CC

    Tools like Ultrasearch, Everything, don't help here as far as I can see.

    XYPlorer can- but it uses the NTFS MFT to list folder sizes, which explorer can't.
    Can't find empty folders using Windows Explorer search function-1.jpg
      My Computers


  3. Posts : 989
    Microsoft Windows 10 Home
       #3

    You can use PowerShell. Assumed you're in the top-level folder you want to search, the command is:

    Code:
    gci -recurse -Directory | ?{(gci $_.Fullname).count -eq 0}
    and for a list of their fully-qualified paths:

    Code:
    gci -recurse -Directory | ?{(gci $_.Fullname).count -eq 0} | select -expand FullName
    Keith
      My Computer


  4. Posts : 141
    Win 10
    Thread Starter
       #4

    Thanks for the replies. I'll try a couple of your suggestions and see what works best for me.
      My Computer


  5. Posts : 97
    Win10 Pro, Version 21H2 (Build 19044.1706) (14.06.2022)
       #5

    Thank you @dalchina for the link to the various "Empty Folder Tools".

    Do you know a tool that is still mantained and get localized for a non english Windows 10 b1903?
    (I would like to see a german context menu entry for such a tool )
      My Computers


  6. Posts : 42,991
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #6

    Hi, you'd need to search for such a tool or check which languages it supports.

    Otherwise you could change the context menu entry yourself, using one of the various context menu editing tools around.

    My guess as to why e.g.
    folder:size<1
    and similar, whilst highlighted as valid syntax, doesn't work is that Windows does not size folders by design.
      My Computers


  7. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #7

    KeithM said:
    You can use PowerShell. Assumed you're in the top-level folder you want to search, the command is: ...and for a list of their fully-qualified paths:
    Code:
    gci -recurse -Directory | ?{(gci $_.Fullname).count -eq 0} | select -expand FullName
    Keith,

    This picked up several correct folders but also one that contained two shortcuts [.lnk files, total size 3KB].

    Is there a way of avoiding this?

    Denis
      My Computer


  8. Posts : 989
    Microsoft Windows 10 Home
       #8

    Try3 said:
    This picked up several correct folders but also one that contained two shortcuts [.lnk files, total size 3KB].
    Is there a way of avoiding this?
    Denis
    Do those files have hidden or system attributes set? Does using the -force parameter change your results?

    Code:
    gci -recurse -Directory | ?{(gci $_.Fullname -force).count -eq 0} | select -expand FullName
    Keith
      My Computer


  9. Posts : 42,991
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #9
      My Computers


  10. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #10

    KeithM said:
    Do those files have hidden or system attributes set? Does using the -force parameter change your results?
    Code:
    gci -recurse -Directory | ?{(gci $_.Fullname -force).count -eq 0} | select -expand FullName
    Keith
    Keith,

    No, they are just standard shortcuts - they have no attributes set but I also tried with their A bits on just for a laugh.

    Can't find empty folders using Windows Explorer search function-test-folder-contents.png

    No, the -force argument makes no dfference.

    - - - - - - - - - - - -

    The folder was called Repair-Volume [ChkDsk]. After I renamed it Repair-Volume ChkDsk I had correct results.
    - To confirm the cause I created another folder with [] in its name and the same thing happened until I removed the [].
    - PS cannot accept even a CD command to a folder with [] in its name.

    So the problem is solved and I've learnt not to include any symbols in folder names if I want to use PS processing.

    This lesson has been valuable so thank you.

    Denis
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:46.
Find Us




Windows 10 Forums