Solved

Full file listing on specific drive

Posted on 2003-11-28
1
292 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

809 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