Click here to Skip to main content
Rate this: bad
good
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 21:25pm
Edited 24-Aug-10 15:18pm
v2
Comments
Dalek Dave at 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
0 OriginalGriff 240
1 Kamal Rocks 184
2 BillWoodruff 173
3 PIEBALDconsult 160
4 CPallini 155
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 25 Aug 2010
Copyright © CodeProject, 1999-2014
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