473,395 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Browse a folder...

228 100+
hi guys,....

I am trying to browse a folder located directly under htdocs. The folder, say called 2007 got 6 subfolders inside it, named 1-6. Each of this subfolders got 2 files each. I need to list the files, creating a link to each file like this

2007/1/file1.pdf
2007/1/file2.pdf
2007/2/file1.pdf
2007/2/file1.pdf


...........How Can I pass the starting folder ie. 2007 then the recursion goes on?

Please help

sam
Apr 28 '07 #1
2 2373
devsusen
136 100+
Hi,

this will be a big code. u need to know Directory functions and File System functions for this purpose. Please go through this sections in php. Try to develop the code. If u then have some problem or bugs, we will certainly help u out for that.

susen
Apr 28 '07 #2
pbmods
5,821 Expert 4TB
Traversing through the directory structure is easy enough. Just use PHP's is_dir function and then create a new directory handler to traverse that directory.

Of course, if you want to also create a link to that file, you've got some complications to deal with. Namely, how do you keep track of which directory each directory handle is working with?

If you said, "Well, I'll just create an array and push the directory name onto it when I create a new handle and pop it off when I delete the handle," then you're not thinking OOP.

My suggestion for approaching this situation is to create your own Directory class and use it to recursively traverse your filesystem.

Make sure you include a maximum depth and an option not to follow symlinks!

And don't forget to save it in your custom frameworks directory so that you can take it with you on other projects, too!
Apr 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: mscir | last post by:
I just installed ASP after a couple of years of not using it, PWS Win 98 SE. A couple of things are throwing me, and I can't remember whether these worked in the past. One is I can't...
21
by: strutsng | last post by:
<input type="file"> only allows the user to browse for files. How about "browse for folder" dialog? Can html/javascript do that? I couldn't find any syntax for that. If not, please advise what...
5
by: deko | last post by:
I'm using the below code to allow users to browse for and select a folder. After selecting a folder from the dialog, the full path is returned to a text box and saved. The next time the user...
5
by: Eric Twietmeyer | last post by:
Hi, Does anyone know why starting with VS.NET 2002 (and same with 2003) it is no longer possible to browse to a directory that has "ept" as part of the path? It worked fine in Vc 6.x. My...
1
by: Ratan | last post by:
Can anybody tell me how to browse folder in ASP.Net, I know there is control for File browse but my requirement is to browse the folder and then just loop through files in that folder and upload...
4
by: Larry Brindise | last post by:
I have an asp.net application. I have used VStudio Web Deployment Project to create the MSI file. I copy the MSI file from my developer PC to my test server running Win2003Server Web Edition. I...
5
by: Dan | last post by:
I am working on a C# ASP.NET project where I need to allow the user to browse to a folder. The only way I see how to do this is use <input type=file>. But this makes the user select a file and...
5
by: Mike Moore | last post by:
I need to create something very similiar to the browse folder capability. This would allow me to support the following - A user would create a document on their server, then they would need to...
3
by: Highlander | last post by:
Hello all. Consider the following HTA: <HTML> <HEAD> <TITLE></TITLE></HEAD> <BODY> <SCRIPT LANGUAGE="VBScript"> Sub ButBrowse_onclick() '-- show browse window and Get file path:
6
by: Kuldeep | last post by:
Framework: Visual Studio 2005 Technology: ASP.NET 2.0 Language: C#.NET 2.0 I am trying to browse folders through the following piece of code. Please let me know if there is any kind of setting...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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 project—planning, coding, testing,...

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.