Solved

How can I produce a list of empty folder ?

Posted on 2009-05-18
7
283 Views
Last Modified: 2013-11-09
How can I produce a lis of empty folder?
I'm hoping I can use a DOS batch file, so I then just produce a batch file of the ones I want to remove
0
Comment
Question by:mindwarpltd
  • 3
  • 2
  • 2
7 Comments
 
LVL 8

Expert Comment

by:Point-In-Cyberspace
ID: 24412849
dir  *.   /s

0
 
LVL 8

Expert Comment

by:Point-In-Cyberspace
ID: 24412857
So you get the list of folders.

Now you can create a text file with it:


dir  *.  /s  > folderlist.txt

In text file you can manually remove what you need.


0
 

Author Comment

by:mindwarpltd
ID: 24412864
That produces a list of folders, not empty folders.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 1

Expert Comment

by:Christop123
ID: 24412915
I believe this link describes what you want to do:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/jul06/hey0710.mspx

It made me a list of the folders on my drive that had a 0 byte count.
Hope that helps.
0
 

Author Comment

by:mindwarpltd
ID: 24412992
I got that script to work, but I know nothing about vbs scripts.

It didn't produce a list, it produced a lot of message boxes.
0
 
LVL 8

Accepted Solution

by:
Point-In-Cyberspace earned 500 total points
ID: 24413003
Then try this:

Save it on c:\ with name "listfolders.vbs"

Run it with

cscript c:\listfolders.vbs > list.txt

You have to run it in the folder from which you want to start.

Il file "list.txt" you'll get the list of empty folders


On Error Resume Next
 
Set FSO = CreateObject("Scripting.FileSystemObject")
ShowSubFolders FSO.GetFolder("C:\")
 
Sub ShowSubFolders(Folder)
    For Each Subfolder in Folder.SubFolders
        If Subfolder.Size = 0 Then
            Wscript.Echo Subfolder.Path
        End If
        ShowSubFolders Subfolder
    Next
End Sub

Open in new window

0
 
LVL 1

Expert Comment

by:Christop123
ID: 24413144
Doh... not even an assist.  :(
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question