|
-
Jun 7th, 2002, 05:15 AM
#1
Thread Starter
Hyperactive Member
This should give you a clue.... (note nobody flame me as it is just a quick knockup example)
VB Code:
Dim fsoMain As New FileSystemObject
Dim oFile As File
Dim oFileColl As Files
Private Sub Command1_Click()
Set oFileColl = fsoMain.GetFolder("c:\winnt").Files
For Each oFile In oFileColl
If oFile.DateLastModified <> Date Then
List1.AddItem oFile.Name
End If
Next oFile
End Sub
-
Jun 9th, 2002, 09:18 PM
#2
New Member
Hi guys,
Thanks for all your help.
I managed to do it and below is my script just
to share with all of you. Again, thanks a lot, appreciates much.
Dim objFSO, objTStream, s, fd, fd2, fd3
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set fd = objFSO.GetFolder("C:\dhl\DCS3.0\logs\")
If fd.files.count > 0 Then
For Each filesx in fd.files
Set fd2 = objFSO.GetFile("C:\dhl\DCS3.0\logs\" & filesx.name)
'Date - 1 day
NewDate = DateAdd("d", -1, Date)
s = fd2.DateCreated
'Date for the File Created
GetDay = DatePart("d", s)
GetMonth = DatePart("m", s)
GetYear = DatePart("yyyy", s)
CreatedDate = DateSerial(GetYear, GetMonth, GetDay)
If CreatedDate = NewDate Then
fd2.Delete
End If
Next
End If
-
Jun 9th, 2002, 09:40 PM
#3
New Member
Hie guys n gals,
Thanks for all the reply. Much appreciated. Below is my code just to share with all the gurus here. Kindly comment freely.
Once again, many thanks to all of you.
Rgds,
andrewseah
Dim objFSO, objTStream, s, fd, fd2, fd3
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set fd = objFSO.GetFolder("C:\dhl\DCS3.0\logs\")
If fd.files.count > 0 Then
For Each filesx in fd.files
Set fd2 = objFSO.GetFile("C:\dhl\DCS3.0\logs\" & filesx.name)
'Date - 1 day
NewDate = DateAdd("d", -1, Date)
s = fd2.DateCreated
'Date for the File Created
GetDay = DatePart("d", s)
GetMonth = DatePart("m", s)
GetYear = DatePart("yyyy", s)
CreatedDate = DateSerial(GetYear, GetMonth, GetDay)
If CreatedDate = NewDate Then
fd2.Delete
End If
Next
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|