Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.
' Autor: Fernando Inácio ' Date: 02-03-2006 ' ' Description : Deletes files of a certain date and time. ' It also generates an output of the total number of deleted ' files and creates a log file. strDateTime = "16-02-2006" strPath = "D:\G\scanner\UAT" strDatediff= " " intFileCount = 0 strComputer = "." Dim logFile Set objFSO = CreateObject("Scripting.FileSystemObject") Set logFile= objFSO.CreateTextFile(strPath & "\deleteFiles.log", True) Set Folder = objFSO.GetFolder(strPath) logFile.Write "Directory Name: " & strPath & VbCrLf logFile.Write "Date: " & Now() & VbCrLf & VbCrLf For Each file In Folder.Files if DateDiff("d", File.DateLastModified, Now) >= 7 Then intFileCount = intFileCount + 1 logFile.Write "File: " & File.name & vbTab & vbTab & File.DateLastModified & VbCrLf logFile.Write CRLF objFSO.DeleteFile(strPath & "\" & file.name) End If Next If intFileCount = 0 Then MsgBox "No files to delete!" Else MsgBox intFileCount & " files deleted!" End If logFile.Write CRLF logFile.Write intFileCount & " File Deleted." logFile.Close Set lofFile = Nothing Set objFSO = Nothing Set Folder = Nothing
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.