开发者

vbscript .DateCreated not coping with new month

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜