Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display Modified Date

Status
Not open for further replies.

rmcp2k

IS-IT--Management
Aug 29, 2005
175
0
0
US
Hello,

Can some one help me with a script? I want the script to list all the files/folder modified within the last week and output it into a text file.

files/folders are network shared; //shared/

thank you for your help
 
Search for:
FileSystemObject
Recurse
DateLastModified

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Code:
Dim fso
Set fso = CreateObject("Scripting.Filesystemobject")

mydate = Now - 7

Set output = fso.CreateTextFile("c:\temp\output.txt",True)
Browse fso.GetFolder("\\myserver\myshare")
output.Close

Sub Browse(folder)
  
  For Each file In folder.Files
    If file.DateLastModified>mydate Then
      output.WriteLine file.path
    End If
  Next
  
  For Each subfolder In folder.SubFolders
    If subfolder.DateLastModified>mydate Then
      output.WriteLine subfolder.path
    End If
    Browse subfolder
  Next
End Sub

Need a good VBScript editor with a debugger? Get VbsEdit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top