Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-04-04
2
Medium Priority
?
246 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 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

610 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