Find last modified file w FileSystemObject

Results 1 to 2 of 2

Thread: Find last modified file w FileSystemObject

  1. #1
    Join Date
    Dec 1969

    Default Find last modified file w FileSystemObject

    I am trying to find a way of retrieving the last modified file in a given directory. At present I am able to write out the files as below but am unable to figure out how to firstly determine and then response.write only the file last modified in a given directory. This would be very useful for pdf especially as the file could be updated to the server by any naming convention and latest only would be writtien reducing the maintenance and also problems with caching. <BR><BR><BR>&#060;%<BR>Dim objFSO, objFile, objFolder, size<BR> <BR><BR>Set objFSO = _<BR> Server.CreateObject("Scripting.FileSystemObject")< BR>Set objFolder = _<BR> objFSO.GetFolder(Server.MapPath("/resources/pbk/downloads/commentary"))<BR> &#039;Response.Write objFolder.Path & "&#060;p&#062;"<BR> For Each objFile in objFolder.Files<BR> size = Round(objFile.Size / 1000)<BR> &#039;Need to find the last modified file and response.write it<BR> Response.Write "&#060;a href=/resources/pbk/downloads/" & objFile.Name & " target=_blank&#062;" & objFile.Name & "&#060;/a&#062; (pdf " & size & "Kb) " & objFile.DateLastModified & "<BR>"<BR> &#039;Response.Write "&#060;a href=/resources/pbk/downloads/commentary/" & objFile.Name & " target=_blank&#062;Market Commentary&#060;/a&#062; (pdf " & size & "Kb)<BR>"<BR> Next<BR> <BR>Set objFolder = Nothing<BR>Set objFSO = Nothing<BR>%&#062;

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default See if FAQ# 118 can help you <eop>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts