List All Empty Folders

  • Thread starter Thread starter Francis
  • Start date Start date
F

Francis

I have a folder with over 3000 vendor files within that folder. Each vendor
files has 10 subfolders, some containing documents and others with no
documents;

C:\Vendor\Name\
C:\Vendor\Agreement\Confidentiality\
C:\Vendor\Agreement\W-9\
C:\Vendor\Agreement\Time_Log\

How can I perform a search to list all folders within \Vendor that are blank?
I have tried a search in Explore but cannot get accurate information.
 
Francis said:
I have a folder with over 3000 vendor files within that folder. Each vendor
files has 10 subfolders, some containing documents and others with no
documents;

C:\Vendor\Name\
C:\Vendor\Agreement\Confidentiality\
C:\Vendor\Agreement\W-9\
C:\Vendor\Agreement\Time_Log\

How can I perform a search to list all folders within \Vendor that are
blank?
I have tried a search in Explore but cannot get accurate information.

Before you can perform a search for "blank" folders you need to think about
the meaning of "blank". Is it
- A folder containing no visible files but perhaps some folders
- A folder containing no files but perhaps some folders
- A folder containing neither files nor folders
 
These would be folders that contain neither files nor folders. They are blank.

thank you for responding.
 
Francis said:
I have a folder with over 3000 vendor files within that folder. Each vendor
files has 10 subfolders, some containing documents and others with no
documents;

C:\Vendor\Name\
C:\Vendor\Agreement\Confidentiality\
C:\Vendor\Agreement\W-9\
C:\Vendor\Agreement\Time_Log\

How can I perform a search to list all folders within \Vendor that are
blank?
I have tried a search in Explore but cannot get accurate information.

Try this batch file:
@echo off
set Target=D:\Test Folder
echo >> c:\TempVBS.vbs Set oFSO = CreateObject("Scripting.FileSystemObject")
echo >> c:\TempVBS.vbs CheckFolder("%Target%")
echo.>> c:\TempVBS.vbs
echo >> c:\TempVBS.vbs Sub CheckFolder(sName)
echo >> c:\TempVBS.vbs If oFSO.GetFolder(sName).Files.Count = 0 _
echo >> c:\TempVBS.vbs And oFSO.GetFolder(sName).SubFolders.Count = 0 _
echo >> c:\TempVBS.vbs Then WScript.Echo sName
echo >> c:\TempVBS.vbs For Each oFolder In oFSO.GetFolder(sname).SubFolders
echo >> c:\TempVBS.vbs CheckFolder(sName ^& "\" ^& oFolder.Name)
echo >> c:\TempVBS.vbs Next
echo >> c:\TempVBS.vbs End Sub
cscript //nologo c:\TempVBS.vbs
del c:\TempVBS.vbs
 
Back
Top