Home | Advertising Info3 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Tuesday, April 16, 2024  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Code Samples
 PowerASP Code Help Area : Classic ASP - Code Samples
Subject Info: Show Directory Contents Using ASP A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: April/27/2004 at 8:14pm | IP Logged Quote cwilliams

Show Directory Contents Using ASP

This is an example of using the FileSystemObject to list the files in a directory.  Replace "somedirectory" with your directory name.

Replace "somedirectory" with your directory name. If you know the physical path you can replace Server.MapPath("/somedirectory") with the actual path like so.
"E:\Inetpub\virtuals\somesite\somedirectory"

Here's the catch.
If you are using NT the directory you run this on must have the correct permissions. Basically the directory needs "read" permissions from the anonymous account or you will get a permission denied error.


<%
Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject" )
Set MyFiles=MyDirectory.GetFolder(Server.MapPath("/somedirectory "))
For each filefound in MyFiles.files
%>


<% =filefound.Name %>
<br>

<%
Next
%>

The results might look something like this.

global.asa
search.htm
dir.asp
check_box.asp
simple-listbox-web-code.asp
radio_buttons.asp
size.asp



__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 
miroen
Newbie
Newbie


Joined: July/27/2005
Online Status: Offline
Info: 1
Added: July/27/2005 at 6:03am | IP Logged Quote miroen

Hi,

Is it possible to do something like this with a internet adress?

Like: Set MyFiles=MyDirectory.GetFolder(Server.MapPath("http://www.dom ain.com/work/"))

Thanks in advance

Back to Top View miroen's Profile Search for other info by miroen
 
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: July/27/2005 at 7:15am | IP Logged Quote cwilliams

no

__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 
mijyk
Newbie
Newbie


Joined: August/02/2005
Online Status: Offline
Info: 1
Added: August/02/2005 at 5:26am | IP Logged Quote mijyk

Hi,

how would i use this to make the results exacutable? for example, if the result was a .mp3 how would i be able to get an open / save box to appear.

Thanks

David

Back to Top View mijyk's Profile Search for other info by mijyk
 
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: August/02/2005 at 9:58am | IP Logged Quote cwilliams

http://www.powerasp.com/content/new/building-hyperlinks.asp

 



__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

vbscript active server pages ASP vbscript SQL database informix oracle SQL Server Perl CGI Delphi PHP source code code sample samples program CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com