Solved

How To Move up one dir

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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 …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now