What is the correct way of determining if a file or folder is empty in powershell? I came across this post and tried the example that the second user gave, and it worked.
Now, I've been checking if a directory is empty by using the length property, like this:
(Get-ChildItem -Path "C:\Users\someUser\Downloads\" -Recurse).Length)
However, that only returns the number of bytes that the file/folder has. I tested the length property and found that if you were to have a blank text file/folder placed in the downloads then the length property wouldn't return the correct value.
Can you use the length property to correctly determine the number of files/folders that a directory has?