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

x
?
Solved

Full file listing on specific drive

Posted on 2003-11-28
1
Medium Priority
?
297 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
[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
1 Comment
 
LVL 14

Accepted Solution

by:
aelatik earned 300 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Suggested Courses

636 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