Solved

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

Posted on 2007-04-04
2
244 Views
Last Modified: 2012-05-05
please help
0
Comment
Question by:itbabe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 500 total points
ID: 18849275

      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)
ID: 18849283
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

724 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