Solved

How To Move up one dir

Posted on 2002-04-28
3
219 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 50 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

829 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