Pozdrav
Imam kod
Option Explicit
Function Bris()
Dim oFSO, oFolder, sDirectoryPath
Dim oFileCollection, oFile, sDir
Dim iDaysOld
' Specify Directory Path From Where You want to clear the old files'
sDirectoryPath = "C:\SERVER\Laboratorija"
' Specify Number of Days Old File to Delete
iDaysOld = 15
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set oFileCollection = oFolder.files
For Each oFile In oFileCollection
'This section will filter the log file as I have used for for test case
'Specify the Extension of file that you want to delete
'and the number with Number of character in the file extension
If LCase(right(CStr(oFile.Name), 3)) = "doc" Then
If oFile.DateLastModified < (Date - iDaysOld) Then
oFile.Delete (True)
End If
End If
Next
Set oFSO = Nothing
Set oFolder = Nothing
Set oFileCollection = Nothing
End Function
Koji brise fajlove iz foldera Laboratorija.
Moj problem je sto zelim izbrisati sve fajlove koji se nalaze u subfolderima datog foldera Laboratorija.Subfoldera ima oko 5000.
Hvala unaprijed