i am new to vb. i need it to create some simple tools that can run from the command line without forms such as this one i downloaded from the web.
i have installed vb6 and when i open it the first thing i get is a form. how can i just write/compile a simple windowless code like you do in c?
thanks for any help!
-----------------------------
Public Function delOldFiles(delDays as integer, scanDir as string)
'<CSCM>
'-----------------------------------------------------'
' Project : XMLSentinel
' Procedure : delOldFiles
' Description: DELETE OLD FILES
' Created by : Project Administrator
' Date-Time : 5/16/2002-4:26:37 PM
' Parameters : delDays -> number of days
' scanDir -> the directory
'-----------------------------------------------------'</CSCM>
Dim fs As Object
On Error GoTo errorHandler
Set fs = CreateObject("Scripting.FileSystemObject"
' CHECK IF THE DIRECTORY EXISTS
If Dir$(scanDir, vbDirectory) <> "" Then
' DIRECTORY DOES EXIST, SO GO ON ...
Dim fileDate As Date ' Declare variables.
Dim f, f1, fc
Set f = fs.GetFolder(scanDir)
Set fc = f.Files
For Each f1 In fc
fileDate = f1.DateCreated
If DateDiff("d", fileDate, Now) > delDays Then
f1.Delete
End If
Next
End If
Set fs = Nothing
Exit Function
errorHandler:
Resume Next
End Function
i have installed vb6 and when i open it the first thing i get is a form. how can i just write/compile a simple windowless code like you do in c?
thanks for any help!
-----------------------------
Public Function delOldFiles(delDays as integer, scanDir as string)
'<CSCM>
'-----------------------------------------------------'
' Project : XMLSentinel
' Procedure : delOldFiles
' Description: DELETE OLD FILES
' Created by : Project Administrator
' Date-Time : 5/16/2002-4:26:37 PM
' Parameters : delDays -> number of days
' scanDir -> the directory
'-----------------------------------------------------'</CSCM>
Dim fs As Object
On Error GoTo errorHandler
Set fs = CreateObject("Scripting.FileSystemObject"
' CHECK IF THE DIRECTORY EXISTS
If Dir$(scanDir, vbDirectory) <> "" Then
' DIRECTORY DOES EXIST, SO GO ON ...
Dim fileDate As Date ' Declare variables.
Dim f, f1, fc
Set f = fs.GetFolder(scanDir)
Set fc = f.Files
For Each f1 In fc
fileDate = f1.DateCreated
If DateDiff("d", fileDate, Now) > delDays Then
f1.Delete
End If
Next
End If
Set fs = Nothing
Exit Function
errorHandler:
Resume Next
End Function