Bb script

Status
Niet open voor verdere reacties.

floor118

Nieuwe gebruiker
Lid geworden
18 feb 2011
Berichten
1
Waarom lukt het me niet om dit werkend te krijgen wat doet het het zou alle cookie bestanden van de gebruikers op de server moeten verwijderen.

Code:
''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
'On Error Resume Next


Const ROOT_FOLDER = "C:\Test"
Dim objFS, objRootFolder, objSubFolder

' FileSystemObject:
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objRootFolder = objFS.GetFolder(ROOT_FOLDER)


For Each objSubfolder In objRootFolder.SubFolders
    If CleanTIF(objSubFolder.Path) = 0 Then
        WScript.Echo "Successfully cleaned '" & objSubFolder.Path & "'"
    Else
        WScript.Echo "FAILED to clean '" & objSubFolder.Path & "'"
    End If
Next


Function CleanTIF(ByVal FolderName)
'  On Error Resume Next
  Dim NextFolder

  CleanTIF = -1

  If objFS.FolderExists(FolderName) <> True Then
    CleanTIF = 3
    Exit Function
  End If

  NextFolder = FolderName & "\Cookies"
  If objFS.FolderExists(NextFolder) = True Then
   Set objFolder = objFS.GetFolder(NextFolder)
   For each objFile in objFolder.files
'      If DateDiff("d", objFile.DateLastModified,Now) > 30 Then
'         'Wscript.echo "File: " & objFile.Name
         objFile.Delete(True)
'      End If
   Next
   Set objFile = Nothing
   Set objCache = Nothing
  End If

  NextFolder = FolderName & "\recent"
  If objFS.FolderExists(NextFolder) = True Then
   Set objFolder = objFS.GetFolder(NextFolder)
   For each objFile in objFolder.files
      If DateDiff("d", objFile.DateLastModified,Now) > 30 Then
         'Wscript.echo "File: " & objFile.Name
         objFile.Delete(True)
      End If
   Next
   Set objFile = Nothing
   Set objCache = Nothing
  End If


  CleanTIF = 0
End Function
''''''''''''''''''''''''''''''''''''''''''''''''
Nu regel 36 Variabele is niet gedefineerd
Wie kan me helpen!
Groetjes!
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan