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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locating Old Files Based on Access Date

Status
Not open for further replies.

supp10967

IS-IT--Management
Jan 17, 2004
23
US
OK.. I've tried a number of freeware utilities.. I get a modified access date which does not match the one i see in the Dir command (dir *.* /s /t a /od > c:\files.txt)

This command seems to give me good data, but..
Problem is I have Millions of files and the data is not usable. It inserts a summary line which I cant manipulate in Excel, Access or anything. There has to be a third party utility that gives you the same info as the DOS Dir command, but in a usable format. (full directory-file path with last accessed date)

Does anyone know why W2k gives you a different last accessed date than the Dir command and which one is actually acurate.
 
I'm not sure what you are looking at. On my system the date that is shown on a DIR command matches the date and time of last modified as displayed in Windows Explorer.

The following script will delete files based on the last modified date. Hope this helps you find what youa re looking for.

Code:
'==========================================================================
'
' VBScript Source File -- 
'
' NAME: CleanBadMail.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL   : [URL unfurl="true"]http://www.thespidersparlor.com[/URL]	
' Copywrite (c) 2003 All rights reserved
' DATE  : 09/10/2003
'
' COMMENT: 
'
' This script will list all filtered and quarantined SPAM mail, check that 
' the files are more than 30 days old and then delete them.
' This file is to be scheduled to run each day.
'=====================================

Path1 = "E:\Program Files\Exchsrvr\Mailroot\vsi 1\BadMail"
Path2 = "E:\Program Files\Trend\SMCF\Quarantine"


Dim fso 
Dim oFolder
Dim oFile
Dim oSubFolder

  Set fso = createobject("Scripting.FileSystemObject")
  
   Set oFolder = fso.GetFolder(Path1)
  
   For Each oFile In oFolder.files

'start debug
'msgbox oFile.name
'End debug

   	If DateDiff("d", oFile.DateCreated,Now) > 30 Then
      
           oFile.Delete True
      
      	End If
  Next


Set oFolder = fso.GetFolder(Path2)
Set colSubfolders = oFolder.Subfolders

For Each oSubfolder in colSubfolders
   	If DateDiff("d", oSubFolder.DateCreated,Now) > 30 Then
		fso.DeleteFolder(oSubFolder)
		
	End If

Next

Set oSubFolder = Nothing
Set oFolder = Nothing
Set fso = Nothing

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top