Solved

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

Posted on 2007-04-04
2
237 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

13 Experts available now in Live!

Get 1:1 Help Now