Solved

Vbscript Question : How can subfolders of a folder be listed ?

Posted on 2007-04-04
2
233 Views
Last Modified: 2012-05-05
please help
0
Comment
Question by:itbabe
  • 2
2 Comments
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 500 total points
Comment Utility

      Set objFolder = fs.GetFolder(sFolderName)
      Set objSubFolders = objFolder.SubFolders
      Set objFiles = objFolder.Files


      'count files
      iTotFiles=iTotFiles + objFiles.count
      'set to remove readonly
      Const READONLY = 1
      For Each xFile In objFiles
            xFile.Attributes = File.Attributes And Not READONLY
      Next

      For Each xFolder In objSubFolders
         xFolder.Attributes = xFolder.Attributes And Not READONLY
          ScanFolder (xFolder.Path)
      Next

      'count directories found
      itotdirs=itotdirs+1
      
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
Comment Utility
sorry this should have
'====================
Sub ScanFolder(sFolderName)

      Dim objFolder, objSubFolders, objFiles
      Dim xFolder, xFile
      Dim ret

      On Error Resume Next

at the top....


You will note the function calls itself.....recursion.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now