Click here to Skip to main content
12,401,158 members (60,238 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VBScript
Hi there !

First off I'd like to say I'm sorry for asking for help, normally I would deal with this stuff myself, but since I'm all new to VBS this has been a pain for me !

Okay, I work for a company with a DFSshare and we have had problems when the share looks empty.
I have to make a VBScript to look for empty folders.
"RootFolder" > "A lot of folders in here representing customers" > "This folder cannot be empty"

This is how far I got, but all it does is give me a glimps ):
Set FSO = CreateObject("Scripting.FileSystemObject")
'Define Root folder
ShowSubfolders FSO.GetFolder("C:\DFSRoots")
Sub ShowSubFolders(Folder)
    'For Each folder, create another For Each instance
    For Each Subfolder in Folder.SubFolders
        For Each subdir in Subfolder.SubFolders
        'Create Status to contain the result
        Status = 0
        'Grab path of the folder to check for empty...ness
            set folder = FSO.GetFolder(subdir.Path)
            'If subdir.Path contains no files, nor folders throw Status 2, otherwise Status 0
            If folder.Files.Count + folder.SubFolders.Count = 0 Then
                Status = 2
                WScript.Echo Status
            Else
                Status = 0
                WScript.Echo Status
            End If
        Next
    Next
End Sub

It would be awesome with a whole code snippet, but a wift in the right direction is also okay Smile | :)
Thanks !
Posted 22-Aug-10 20:25pm
Updated 24-Aug-10 14:18pm
Dalek Dave433.4K
v2
Comments
Dalek Dave 24-Aug-10 20:19pm
   
Edited for Grammar and Spelling.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Seems that the recursion [^] is missing in your method?

Cheers
Uwe
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 25 Aug 2010
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100