Solved

Full file listing on specific drive

Posted on 2003-11-28
1
293 Views
Last Modified: 2010-05-01
Hi,

I am trying to develop and Achive Policy for my office. Before I can decide what is the most appropriate and effective method to use I need to examine the files on the network dirves. I intended to get a list of all the files, including all other relevant information such as "Modified Date", "Last Accessed Date", etc. I would then import this list into Access/Excel and then run some statistics on usage, dates, locations, etc.

The problem I am having is that I CAN get a list of files and sub-folders for a particular folder that I specify, but how do I can a list of all the files starting from the root of the hard drive. I thought that this may have been a easy process but there are folders under folders under folders and so on.

I am using MS VBScript with IE 6.01. The operating system is Windows NT 4.00 SP6a but should work with Active Directory as well.

Help would much appreciated.

Thanks
0
Comment
Question by:AlvanRowland
1 Comment
 
LVL 14

Accepted Solution

by:
aelatik earned 75 total points
ID: 9839244
Since you know how to get the propertys you only have to implement a recursice file search :

Dim FSO, FSO_DIRECTORY, FSO_FILES, FSO_DIRECTORYS

Function DirectoryInformation(folder)
        Set FSO = CreateObject("Scripting.FileSystemObject")
        On Error Resume Next
        Set FSO_DIRECTORY = FSO.GetFolder(folder)
        Set FSO_FILES = FSO_DIRECTORY.Files
        Set FSO_DIRECTORYS = FSO_DIRECTORY.Subfolders
            If FSO_FILES.Count > 0 Then
                    For Each FSO_FILE In FSO_FILES
                        If FSO_FILE <> "" Then MsgBox FSO_FILE
                    Next FSO_FILE
            End If
            If FSO_DIRECTORY.Count > 0 Then
                For Each FSO_SUBDIRECTORY In FSO_DIRECTORYS
                    DirectoryInformation (FSO_SUBDIRECTORY)
                Next
            End If
        Set FSO_DIRECTORY = Nothing
        Set FSO_FILES = Nothing
        Set FSO_DIRECTORYS = Nothing
End Function

' usage

Call DirectoryInformation("c:\")

I copied it from my VB project so you have to change msgbox to something else ( wscript.echo )
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSON Response and request in VB6 application 11 777
MS Acccess - Update Field in Table when report is printed 6 50
VB6 ListBox Question 4 55
Automatic Email Reminder 4 70
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 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