All source code in ASP/ VbScript Ask a ASP/ VbScript Pro Discussion Forum Categories All jobs in ASP/ VbScript
Quick Search for:  in language:    
Will,Display,Files,File,Size,date,every,direc
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 281,486. lines
 Jobs: 101. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login

NEW! LEARNING CENTER
Special educational offers, white papers, webcasts, podcasts

  NEW! Download Rational Performance Tester V8 (download now)
  NEW! Download Rational Functional Tester V8 (download now)
  NEW! Download Rational Service Tester for SOA Quality V8 (download now)
  NEW! Teleconference: Quality In Action - Using Rational Quality Manager with Functional, Performance and Web Service Testing Products (download now)
  NEW! Introducing IBM Rational AppScan Developer Edition – easing security testing by non-security professionals (download now)

 

 


Latest postings for ASP/ VbScript.
Click here to see a screenshot of this code!Mess Officer Management System (Sistem Pengurusan Mess Pegawai)
By Mohd Fauzi on 11/23

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!



 
 
   

File / Directory Viewer

Print
Email
 
VB icon
Submitted on: 5/30/2000 2:54:32 PM
By: Thomas Michael  
Level: Beginner
User Rating: By 13 Users
Compatibility:ASP (Active Server Pages), VbScript (browser/client side)

Users have accessed this code 33107 times.
 
(About the author)
 
     This Will Display All The Files, File Size and file date of every file in the directory you specify. To make this work, paste the code into your favorite html editor, save it and then view it.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' Name: File / Directory Viewer
    ' Description:This Will Display All The 
    '     Files, File Size and file date of every 
    '     file in the directory you specify.
    To make this work, paste the code into your favorite html editor, save it and Then view it.
    ' By: Thomas Michael
    '
    ' Assumes:File System Object Be Needed :
    '     ) and it is setup to look for you my doc
    '     uments folder at "c:\mydocu~1" but you c
    '     an change the line of code to look in an
    '     y directory.
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=6204&lngWId=4    'for details.    '**************************************
    
    <%@ LANGUAGE="VBSCRIPT" %>
    <% Option Explicit %>
    <HTML>
    <HEAD> <TITLE>File Viewer</TITLE> </HEAD>
    <BODY>
    <TABLE width="100%" border=1 bordercolor="#000000" align="left" cellpadding="2" cellspacing="0">
    <TR align="left" valign="top" bgcolor="#000000"> 
    	<TD width="65%"><FONT color="#FFFFFF"><B><FONT size="2" face="Verdana, Arial, Helvetica, sans-serif">Title</FONT></B></FONT></TD>
    <TD width="10%"><FONT color="#FFFFFF"><B><FONT size="2" face="Verdana, Arial, Helvetica, sans-serif">Size</FONT></B></FONT></TD>
    <TD width="25%"><FONT color="#FFFFFF"><B><FONT size="2" face="Verdana, Arial, Helvetica, sans-serif">Date</FONT></B></FONT></TD>
    </TR>
    <%
    	'File System Object
    	Dim objFSO
    	'File Object
    	Dim objFile
    	'Folder Object
    	Dim objFolder
    	'String To Store The Real Path
    	Dim sMapPath
    	'Create File System Object To Get list of files
    	Set objFSO = CreateObject("Scripting.FileSystemObject")
    	'Get The path For the web page and its dir.
    	'change this setting To view different directories
    	sMapPath = "C:\Mydocu~1"
    	'Set the object folder To the mapped path
    	Set objFolder = objFSO.GetFolder(sMapPath)
    	'For Each file In the folder
    	For Each objFile In objFolder.Files
    	%> 
    	<TR align="left" valign="top" bordercolor="#999999" bgcolor="#FFFFFF"> 
    	<TD> <FONT size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000"><A href="<% = sMapPath & "/" & objFile.Name %>"> 
    	<%
    			'write the files name
    			Response.Write objFile.Name
    	%>
    	</A>
    	</FONT>
    	</TD>
    <TD>
    	<FONT size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">
    	
    	<%
    			'We will format the file size so it looks pretty
    			if objFile.Size <1024 Then
    				Response.Write objFile.Size & " Bytes"
    			ElseIf objFile.Size < 1048576 Then
    				Response.Write Round(objFile.Size / 1024.1) & " KB"
    			Else
    				Response.Write Round((objFile.Size/1024)/1024.1) & " MB"
    			End if
    	%>
    	</FONT>
    	</TD>
    <TD>
    		<FONT size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">
    			<%	'the files Date 
    				Response.Write objFile.DateLastModified
    			%>
    		</FONT>
    	</TD>
    	</FONT>
    	</TD>
    	</TR>
    	<%
    		Next
    	%> 
    </TABLE>
    </BODY>
    </HTML>


Other 3 submission(s) by this author

 

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
5/30/2000 4:29:08 PMPhil

I was wondering if there was a way to do this and sort the files by the date?
(If this comment was disrespectful, please report it.)

 
5/30/2000 5:22:33 PMThomas Michael

To do the date sorting, you could load the files into an array and perform a sort on the array or you could check the files as you go. I will post the code for sorting in a bit
(If this comment was disrespectful, please report it.)

 
8/22/2000 5:48:28 PMG. M. Faggiano

I need the filesystem object
(If this comment was disrespectful, please report it.)

 
10/8/2000 1:48:01 PMfonetapx

Im a beginner to asp, vbscript programming but im very interested. I copied the code from above and pasted it in an HTML editor and saved it. But when I open it all i see is "> Under the File Name.. Can Someone Help Me?
(If this comment was disrespectful, please report it.)

 
10/12/2000 4:19:27 PMJustin Boxwell

thanks man, this is just what i needed to learn for my site
(If this comment was disrespectful, please report it.)

 
11/26/2000 1:54:54 PM[New Comics]Benjy.

Hi!
Your code is just what I needed.
But could you post the 'how to sort the files' code?

THANKS!
(If this comment was disrespectful, please report it.)

 
3/21/2001 1:49:55 PMTKasmir

This is very good...how can you alter it so that it will display all SUB-FOLDERS of the parent directory? Also showing the folder size would be useful.
(If this comment was disrespectful, please report it.)

 
7/9/2001 5:32:38 PMSSJDT

fonetapx, I have the same problem as you and I can't figure out why. I think it must have be some security patch or something blocking the script.
(If this comment was disrespectful, please report it.)

 
3/11/2002 7:00:31 PMBill

I have the exact same problem as was previously posted below:

Im a beginner to asp, vbscript
programming but im very interested. I
copied the code from above and pasted
it in an HTML editor and saved it. But
when I open it all i see is "> Under
the File Name.. Can Someone Help Me?

----------------------
So, what is the answer to this problem?

Thanks

(If this comment was disrespectful, please report it.)

 
7/6/2002 9:29:34 AMstaut

Hi,
I wondered if you had any luck with the sorting stuff. I could really use this feature. Can you help me?
(If this comment was disrespectful, please report it.)

 
7/14/2002 9:54:11 PMCarol

I am having the same problem I do not see anything when I run the code in my browser.....
(If this comment was disrespectful, please report it.)

 
2/7/2003 4:13:32 AMKaliana

I use different computer for server, and this code didn't work for local directory. It only can show the directory in the server..
(If this comment was disrespectful, please report it.)

 
2/23/2003 2:44:48 PM

I was wondering if anything modification can be made to the code to do a search, say by date of keyword.
Thank you, good code!
(If this comment was disrespectful, please report it.)

 
3/19/2003 6:12:57 PM

This code will just not work for me! I cannot get the code to list me ANYTHING!!! ARRGGHHH!
(If this comment was disrespectful, please report it.)

 
4/9/2003 7:09:35 AM

I also have the folowing problem..
"I copied the code from above and pasted it in an HTML editor and saved it. But when I open it all i see is "> Under the File Name.. "

Would anyone can teach me?Thanks!

(If this comment was disrespectful, please report it.)

 
12/5/2004 10:28:01 PM

I am having the same problem as most of the others. I am new to ASP and it didn't display anything in my browser. Any help would be great.
(If this comment was disrespectful, please report it.)

 
1/20/2005 6:39:18 PM

The thing with this code is that it only shows local directorys.
(If this comment was disrespectful, please report it.)

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.


 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | Open Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2008 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.   Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.