![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Looping through directory I have a directory named USERS which contains about 100 unique user folders. Each user folder contains a folder named RECYCLER and I would like to generate a report of the size of each user's RECYCLER folder. I already know how to use vbs to lookup a folder size and write the results to a log file. But what I don't know how to do is loop through the directories in the first place. Anyone know how to do this? Thanks! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Looping through directory "D.P. Roberts" <dproberts@xxxxxx> wrote in message news:eeEfZLScJHA.1328@xxxxxx Quote: >I have a directory named USERS which contains about 100 unique user >folders. Each user folder contains a folder named RECYCLER and I would like >to generate a report of the size of each user's RECYCLER folder. I already >know how to use vbs to lookup a folder size and write the results to a log >file. But what I don't know how to do is loop through the directories in >the first place. Anyone know how to do this? > > Thanks! Function ShowFolderList(folderspec) Dim fso, f, f1, s, sf Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(folderspec) Set sf = f.SubFolders For Each f1 in sf s = s & f1.name s = s & "<BR>" Next ShowFolderList = s End Function -Paul Randall |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Looping through directory You might want to take a look at Powershell 2.0 CTP. It lets you use simple DOS-like commands to control the framework. - David "Paul Randall" <paulr90@xxxxxx> wrote in message news:egTvbzTcJHA.1732@xxxxxx Quote: > > "D.P. Roberts" <dproberts@xxxxxx> wrote in message > news:eeEfZLScJHA.1328@xxxxxx Quote: >>I have a directory named USERS which contains about 100 unique user >>folders. Each user folder contains a folder named RECYCLER and I would >>like to generate a report of the size of each user's RECYCLER folder. I >>already know how to use vbs to lookup a folder size and write the results >>to a log file. But what I don't know how to do is loop through the >>directories in the first place. Anyone know how to do this? >> >> Thanks! > Sample code from the scripting help file SCRIPT56.CHM: > > Function ShowFolderList(folderspec) > Dim fso, f, f1, s, sf > Set fso = CreateObject("Scripting.FileSystemObject") > Set f = fso.GetFolder(folderspec) > Set sf = f.SubFolders > For Each f1 in sf > s = s & f1.name > s = s & "<BR>" > Next > ShowFolderList = s > End Function > > -Paul Randall > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Looping through directory Thank you very much. This was most helpful and I appreciate your taking the time to answer my question. "Paul Randall" <paulr90@xxxxxx> wrote in message news:egTvbzTcJHA.1732@xxxxxx Quote: > > "D.P. Roberts" <dproberts@xxxxxx> wrote in message > news:eeEfZLScJHA.1328@xxxxxx Quote: >>I have a directory named USERS which contains about 100 unique user >>folders. Each user folder contains a folder named RECYCLER and I would >>like to generate a report of the size of each user's RECYCLER folder. I >>already know how to use vbs to lookup a folder size and write the results >>to a log file. But what I don't know how to do is loop through the >>directories in the first place. Anyone know how to do this? >> >> Thanks! > Sample code from the scripting help file SCRIPT56.CHM: > > Function ShowFolderList(folderspec) > Dim fso, f, f1, s, sf > Set fso = CreateObject("Scripting.FileSystemObject") > Set f = fso.GetFolder(folderspec) > Set sf = f.SubFolders > For Each f1 in sf > s = s & f1.name > s = s & "<BR>" > Next > ShowFolderList = s > End Function > > -Paul Randall > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| err object and looping | VB Script | |||
| Looping through each file in a directory: Powershell noob question | PowerShell | |||
| Help looping a script | PowerShell | |||
| AD Changes and Looping | PowerShell | |||
| Looping at start | Vista installation & setup | |||