Solved

How To Move up one dir

Posted on 2002-04-28
3
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP encrypted string and passing to a ASP Page 12 50
while read ID; do 4 58
xml with php question 5 37
How do I post more than 1 item to php backend 24 32
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

726 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