Can't find empty folders using Windows Explorer search function

Page 2 of 2 FirstFirst 12
  1. KeithM's Avatar
    Posts : 796
    Microsoft Windows 10 Home
       #11

    Try3 said:
    No, they are just standard shortcuts - they have no attributes set but I also tried with their A bits on although I couldn't see any logic to doing so.
    Weird. When you run this command, what count value is displayed for the problem folders?
    Code:
    gci -recurse -Directory | ?{(gci $_.Fullname -force).count -eq 0} | select @{N = 'gciCount'; E = {(gci $_.Fullname -force).count}}, FullName | out-gridview
      My Computer

  2. Try3's Avatar
    Posts : 7,466
    Windows 10 Home x64 Version 20H2 Build 19042.928
       #12

    Keith,

    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

  3. KeithM's Avatar
    Posts : 796
    Microsoft Windows 10 Home
       #13

    Thank you. I just learned something too!
      My Computer

  4. Try3's Avatar
    Posts : 7,466
    Windows 10 Home x64 Version 20H2 Build 19042.928
       #14

    Keith,

    And while it had the [] in its name it was count value 0, which makes sense.

    I probably have countless folders-files with [] in their names. I have always been able to process them correctly in batch files, vbs & VBA. I'll have to work through a recursive batch file to find them & rename them.

    I never use certain symbols, for example &, in folder-file names because they can trip me up in batch file processing even if I think I have provided for them**. But [] have never been a problem before.

    {** For instance, using set "SomeVar=this&that" allows many common symbols to get processed without causing problems.}

    Denis
      My Computer

  5. KeithM's Avatar
    Posts : 796
    Microsoft Windows 10 Home
       #15

    I think this is a case where using the -LiteralPath paramater (as opposed to default -Path) will give you correct results:

    Code:
    gci -recurse -Directory | ?{(gci -LiteralPath $_.Fullname -force).count -eq 0} | select @{N = 'gciCount'; E = {(gci -LiteralPath $_.Fullname -force).count}}, FullName | out-gridview
      My Computer

  6. Try3's Avatar
    Posts : 7,466
    Windows 10 Home x64 Version 20H2 Build 19042.928
       #16

    Keith,

    You are correct. And I've used -LiteralPath before but had forgotten its significance. I must get around to opening my PS for idiots book and study it properly instead of just stumbling my way through only when I cannot put together a batch file / vbs / VBA solution for something.

    Denis
      My Computer


 
Page 2 of 2 FirstFirst 12

  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 03:24.
Find Us




Windows 10 Forums