473,748 Members | 5,242 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 20992
"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
1935
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
2011
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
10865
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
1637
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
3569
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
1402
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
840
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
1474
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
9534
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
9366
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
9316
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
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
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
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
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.