Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: FSO - date of file displayed


Message #1 by "Matthew Lohr" <mlohr@t...> on Tue, 27 Mar 2001 14:08:56 -0500
I have been playing with this for a little while and just can't seem to get

any code right.  I have a hyperlink to a file and want to display when this

file was created.  I feel i need to use the File System Object but am not

sure how.





my link is like <a href="excelfile.xls">excel report</a> and when it is

displayed I want the date of that file displayed next to it.  Any help is

appreciated



Message #2 by "Craig Flannigan" <ckf@k...> on Wed, 28 Mar 2001 12:48:56 +0100
I use this to list files stored in a folder on our

WebServer.



	<%



	UseFolder = "C:\YourFolderHere"



	Dim fso, f, f1, fc, s

	Set fso = CreateObject("Scripting.FileSystemObject")

	Set f = fso.GetFolder(UseFolder)

	Set fc = f.Files



	For Each f1 in fc



		You'll need to write the HTML around it, but this is it

basically.



		Filename 		= f1.Name

		Size			= f1.size

		DateLastModified	= f1.DateLastModified



	Next





	%>





Hope this helps.

Regards,

Craig.





-----Original Message-----

From: Matthew Lohr [mailto:mlohr@t...]

Sent: 27 March 2001 08:09 PM

To: ASP Web HowTo

Subject: [asp_web_howto] FSO - date of file displayed





I have been playing with this for a little while and just

can't seem to get

any code right.  I have a hyperlink to a file and want to

display when this

file was created.  I feel i need to use the File System

Object but am not

sure how.





my link is like <a href="excelfile.xls">excel report</a> and

when it is

displayed I want the date of that file displayed next to it.

Any help is

appreciated



Message #3 by "Matthew Lohr" <mlohr@t...> on Wed, 28 Mar 2001 09:14:25 -0500
The thing is I know which file I need the date from and want to display the

date from only the one file



-----Original Message-----

From: Craig Flannigan [mailto:ckf@k...]

Sent: Wednesday, March 28, 2001 6:49 AM

To: ASP Web HowTo

Subject: [asp_web_howto] RE: FSO - date of file displayed





I use this to list files stored in a folder on our

WebServer.



	<%



	UseFolder = "C:\YourFolderHere"



	Dim fso, f, f1, fc, s

	Set fso = CreateObject("Scripting.FileSystemObject")

	Set f = fso.GetFolder(UseFolder)

	Set fc = f.Files



	For Each f1 in fc



		You'll need to write the HTML around it, but this is it

basically.



		Filename 		= f1.Name

		Size			= f1.size

		DateLastModified	= f1.DateLastModified



	Next





	%>





Hope this helps.

Regards,

Craig.





-----Original Message-----

From: Matthew Lohr [mailto:mlohr@t...]

Sent: 27 March 2001 08:09 PM

To: ASP Web HowTo

Subject: [asp_web_howto] FSO - date of file displayed





I have been playing with this for a little while and just

can't seem to get

any code right.  I have a hyperlink to a file and want to

display when this

file was created.  I feel i need to use the File System

Object but am not

sure how.





my link is like <a href="excelfile.xls">excel report</a> and

when it is

displayed I want the date of that file displayed next to it.

Any help is

appreciated



Message #4 by <mzcfilip@y...> on Wed, 28 Mar 2001 13:03:01 -0500
set objFSO= server.CreateObject("scripting.FileSystemObject")

PathToFile="C:\inetpub\wwwroot\yourfile" ' or whatever

set TheFile= objFSO.GetFile(PathToFile)



response.write "<a href=""/HTML link to your file/"">YourFileName</a> last modified : " &

TheFile.DateLastModified & "<BR>" & vbcrlf



set TheFile=nothing

set objFSO=nothing



e-mail wrapping will murder that, but the response.write is a one-liner for the link, and the

important bit for you is the "TheFile.DateLastModified".  That's all you need...

of course, there's also "TheFile.DateCreated" and "TheFile.DateLastAccessed".



enjoy



-mike



-----Original Message-----

From: Matthew Lohr [mailto:mlohr@t...]

Sent: Tuesday, March 27, 2001 2:09 PM

To: ASP Web HowTo

Subject: [asp_web_howto] FSO - date of file displayed





I have been playing with this for a little while and just can't seem to get

any code right.  I have a hyperlink to a file and want to display when this

file was created.  I feel i need to use the File System Object but am not

sure how.





my link is like <a href="excelfile.xls">excel report</a> and when it is

displayed I want the date of that file displayed next to it.  Any help is

appreciated


  Return to Index