开发者

vbscript .DateCreated not coping with new month

开发者 https://www.devze.com 2023-03-09 13:50 出处:网络
I\'m using the following code to find the newest .zip file in a directory but it doesn\'t seem to be coping with the switch to June and still shows the newest file as yesterdays.

I'm using the following code to find the newest .zip file in a directory but it doesn't seem to be coping with the switch to June and still shows the newest file as yesterdays.

When I ran the script today it showed a file from 31/05/2011 06:05 as the latest but there are two newer files than this (see screenshot)

For Each aFile In ImportFldr.Files
sExtension = fso.GetExtensionName(aFile.Name)
    If sExtension = "log" Then
            'Msgbox "The file extension is 开发者_如何学JAVAa " & sExtension
        Else
            'Msgbox "The file extension is a " & sExtension
                         If fileNewest = "" Then
                        Set fileNewest = aFile  
                     Else
                     If fileNewest.DateCreated < aFile.DateCreated Then
                            Set fileNewest = aFile
                     End If
                    End If
                End If
Next

vbscript .DateCreated not coping with new month

Thanks


The problem may be that you are checking the file creation date (DateCreated) whereas Explorer shows the last modification date (DateLastModified). Add the Date created column to the Explorer's view and see if the script's result makes sense after that.

0

精彩评论

暂无评论...
验证码 换一张
取 消