Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: BlueDevilFanPosted on 2005-04-07 at 08:35:11ID: 13728060
Hi stevengreen,
leSystemOb ject")
h) Path)
The following script should do the trick. To use it do the following:
1. Start Notepad
2. Copy the script below and paste it into Notepad
3. Edit the script as needed. You'll need to change strBasePath to point to the root of the path you want the script to run against
4. Save the Notepad file. You may name it anything you want so long as the name ends with .vbs
5. Run the script by issuing this command from either a command prompt or the run command dialog-box:
cscript scriptname.vbs > outputfilename
'Script begins here
Option Explicit
Dim objFSO, intFolders, intFiles, strBasePath
Set objFSO = CreateObject("Scripting.Fi
'Set the path to the folder we'll start in
strBasePath = "C:\"
'Call the ProcessFolder subroutine and pass it the starting path
ProcessFolder strBasePath
'Clean up
Set objFSO = Nothing
Wscript.Echo ""
Wscript.Echo "Folders = " & intFolders & vbtab & "Files = " & intFiles
Wscript.Quit
Private Sub ProcessFolder(strFolderPat
Dim objFolder, objSubFolders
'Create the starting folder object
Set objFolder = objFSO.GetFolder(strFolder
'Call the ProcessFiles subroutine and pass it the folder object
ProcessFiles objFolder
intFolders = intFolders + 1
'Create the sub-folders object
Set objSubFolders = objFolder.SubFolders
'Loop through the sub-folders in the folder object
For Each objFolder In objSubFolders
'Call the ProcessFiles subroutine and pass it the sub-folder object
ProcessFolder objFolder.Path
intFolders = intFolders + 1
Next
'Dispose of the created objects
Set objSubFolders = Nothing
Set objFolder = Nothing
End Sub
Private Sub ProcessFiles(objFolder)
Dim objFile
'Loop through the files in the folder object
For Each objFile In objFolder.Files
If Datediff("m", objFile.DateLastAccessed, date()) >= 1 Then
Wscript.Echo objFile.Path
intFiles = intFiles + 1
End If
Next
'Dispose of the object created in this subroutine
Set objFile = Nothing
End Sub
'Script ends here
Cheers!