473,698 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get a list of files on a website

Greetings,

I need to get a list of all files in a particular virtual directory on
a web site, such as -
http://www.myServer.com/FileStore

I tried using the directory functions, but this doesn't work.

if($dirHandle = opendir("http://www.myServer.co m/FileStore/"))
{
while(false !== ($file = readdir($dirHan dle)))
{
print($file."<b r>");
}
}
closedir($handl e);
}

Is there a way to do this?

Thanks,
Harold

Jul 17 '05 #1
3 20989
"Harold Crump" <or**********@y ahoo.com> wrote in
news:11******** **************@ f14g2000cwb.goo glegroups.com:
Greetings,

I need to get a list of all files in a particular virtual directory on
a web site, such as -
http://www.myServer.com/FileStore

I tried using the directory functions, but this doesn't work.

if($dirHandle = opendir("http://www.myServer.co m/FileStore/"))
{
while(false !== ($file = readdir($dirHan dle)))
{
print($file."<b r>");
}
}
closedir($handl e);
}

Is there a way to do this?


opendir is meant to be used on the same server on which the script is
running.

you can't just connect to any website folder on the internet and download
everything in it!!
Jul 17 '05 #2
NC
Harold Crump wrote:

I need to get a list of all files in a particular virtual
directory on a web site, such as -
http://www.myServer.com/FileStore

I tried using the directory functions, but this doesn't work.
Directory functions only work on local file systems, not
over HTTP. This is clearly spelled out in the PHP Manual.
Is there a way to do this?


Yes, but only under two conditions (both are required):

1. There is no directory index in the target directory, and
2. The HTTP server on the remote system is allowed to
provide the directory listing in response to a request
for the directory name.

In Apache, the name of the directory index is set by the
DirectoryIndex directive. To allow listing the contents
of the directory, you should specify the Options Indexes
directive.

Cheers,
NC

Jul 17 '05 #3
NC wrote :
Harold Crump wrote:

I need to get a list of all files in a particular virtual
directory on a web site, such as -
http://www.myServer.com/FileStore

I tried using the directory functions, but this doesn't work.


Directory functions only work on local file systems, not
over HTTP. This is clearly spelled out in the PHP Manual.
Is there a way to do this?


Yes, but only under two conditions (both are required):

1. There is no directory index in the target directory, and
2. The HTTP server on the remote system is allowed to
provide the directory listing in response to a request
for the directory name.

In Apache, the name of the directory index is set by the
DirectoryIndex directive. To allow listing the contents
of the directory, you should specify the Options Indexes
directive.

Cheers,
NC


Even with these two conditions met, how would the php script know what
the files are? Wouldnt the return result just be an HTML page with <a>
tags that may or may not be links to files?

The web server software "apache", "IIS", etc would each spit out the
directory listing differently. However, all in HTML.

I would have thought the only way to do this would be to an FTP server.

--
if the oil light is on, dont think it will just go away

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1929
by: LarryM | last post by:
Hi, This is maybe not a pure ASP question, but has some relation: Please help me throw some light on this: Which directories and files are visible and readable for a (hacking) user at a Website: a) directories in the default website (obviously: YES) b) .asp-files in the default Website c) .asp-files in any diretory outside the default Website
8
829
by: Opa | last post by:
Hi, Does anyone know how to get a list of files for a given directory from a given url. I have the following, but get an error indicating that URI formats are not supported. System.IO.DirectoryInfo di di = new System.IO.DirectoryInfo("http://www.websitehere.com/files/"); System.IO.FileInfo rgFiles = di.GetFiles("*.jpg");
1
2004
by: Marc Pelletier | last post by:
Hello all, I am a desktop programmer getting my feet wet on the web. I am trying to build a .net website that will keep a set of local files synchronized with a master set on the web. Using a cookie I can keep track of when the user last synced and build a file list in my asp.net code that displays which files need downloading. Next I want to put a button on the page that will download all of the files
9
10862
by: Marco Castro | last post by:
I tried to google for information of what the output of the "LIST" command means but couldn't find any articles that tell me exactly what every character means. I can figure out most of it, its only the first 12 characters where you see stuff like +rwx and so on that I am having trouble with. Does anyone know of a website that explains in detail what all of the values mean? Thanks.
2
1632
by: AAJ | last post by:
Hi all I have a few questions about file locations with VS2005, localhost WidowsXP and remotehost Server2003, and I wonder if anyone can help me get started 1) If I build a web site on my local server i.e. Creat WebSite from the opening menu, I can select my local webserver. Most of the files seem to be within InetPub\wwwroot\website\...
4
3567
by: AAJ | last post by:
Hi all Is it possible to programatically list all the .aspx files within the currenty running website. e.g. something like foreach {aspxfile in AllaspxFilesInMyProject) { string filename = aspxfile.title; }
1
1396
by: aaapaul | last post by:
What is the best way to transfer the necessary files of a website to the webserver. In VS2003 there was a possibility to say Project copy -only files, which are necessary for running ! I cant find the same in VS 2005 ! greetings aaapaul
0
837
by: Jeremy | last post by:
We have files arriving via ftp to a server which is on a different domain than the intranet webserver. I want to be able to manipulate these files from the website. Both domains are within the firewall. I've tried creating a virtual directory, but don't know how to give aspnet the right permissions. Likewise, I created a DFS root on the webserver, added a link to the ftp data folder, but again, the website doesn't have permission (I...
3
1467
by: saurabhthakur | last post by:
hello, i am using .net 1.1,vb ,i have 2 web applications.one is installed in client side server which is currently working offline(intranet)..other is at my side which is online website.frequently i have to give master data to client .So using httprequest and xml , i am giving him data.I have given one option to client side application from where he connects to online application and fetches the data. now the problem is that he is asking for...
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.