How to deal with file path with space? I tried use %20 as space but it doesn't work.
Set fso = CreateObject("Scripting.FileSystemObject")
FolderPath="C:\My folder path\Target folder"
Set myLog = fso.OpenTextFile(deleteLogFile, 2, True)
GetRecentFile fso.GetFolder(FolderPath) '<-- I am getting error here
DeleteFiles fso.GetFolder(FolderPath) '<-- I am getting error here
Function GetRecentFile(srcFolder)
Set GetRecentFile = Nothing
For Each file in fso.GetFolder(srcFolder).Files
If GetRecentFile is Nothing Then
Set GetRecentFile = file
ElseIf file.DateLastModified > GetRecentFile.DateLastModified Then
Set GetRecentFile = file
End If
Next
LatestDate = GetRecentFile.DateLastModified
End Function