?
Solved

How To Move up one dir

Posted on 2002-04-28
3
Medium Priority
?
227 Views
Last Modified: 2008-03-06
Using this code
$thisdir=opendir('.');
I am able to cycle through the contents of the current dir,

what i want to do is the same thing for the dir above the ccurrent i thought that
$thisdir=opendir('..');
would do the job but is does not what is the corrent argument for one dir above the current one.

thanks -k-
0
Comment
Question by:kplonk
  • 2
3 Comments
 
LVL 7

Expert Comment

by:axis_img
ID: 6976284
opendir("..") has always worked for me. Can you give some information as to what system you are running currently?

Also, try:

opendir("../")

I do not think the slash should make a big difference, as both methods work for me. Just to be sure though.

Regards,
Barry
0
 
LVL 7

Accepted Solution

by:
axis_img earned 200 total points
ID: 6976364
One other suggestion, which is admittedly a bit of a hack, is to simply chdir() directly before opening the current directory ("."). An example would be:

chdir("..");
$thisdir = opendir("."); // now the current directory is actually ".."

// do stuff here...
closedir($thisdir);


If I am not understanding what you are asking, please let me know.

Thanks
0
 

Author Comment

by:kplonk
ID: 6977074
Seems i .. was wroking however the proble laied more in the script the chdir() command sorted that so thatanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question