473,406 Members | 2,549 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,406 software developers and data experts.

Directory $path syntax problem

Hello,

I have a script that lists the contents of a directory. It was
working properly until we had to change the directory that it reads
from.

The path to this script is:

/home/n/mu1/database/refresh.php.

I'd like it to list the contents in the main directory of the site:
mu1

So I have this code to list (up one level from the script):

$path = "../mu1/";
$dir_handle = opendir($path) or die("Unable to open directory $path");

But I get this error message when I try to run it:

Warning: opendir(../mu1/) [function.opendir]: failed to open dir: No
such file or directory in /home/n/mu1/database/refresh.php on line 19
Unable to open directory ../mu1/

Any idea what I'm doing wrong?

Thanks!

Mar 4 '08 #1
2 3008
On Mar 4, 12:06 pm, WPW07 <wwisnie...@gmail.comwrote:
Hello,

I have a script that lists the contents of a directory. It was
working properly until we had to change the directory that it reads
from.

The path to this script is:

/home/n/mu1/database/refresh.php.

I'd like it to list the contents in the main directory of the site:
mu1

So I have this code to list (up one level from the script):

$path = "../mu1/";
$dir_handle = opendir($path) or die("Unable to open directory $path");

But I get this error message when I try to run it:

Warning: opendir(../mu1/) [function.opendir]: failed to open dir: No
such file or directory in /home/n/mu1/database/refresh.php on line 19
Unable to open directory ../mu1/

Any idea what I'm doing wrong?

Thanks!
From your location in /home/n/mu1/database/refresh.php the value
of ../ would be the directory above /database which is /mu1. So, "../
mu1" is really /home/n/mu1/mu1/ which probably isn't what you want.
If you're inside /database you get to mu1 with ../ by itself.
Mar 4 '08 #2
On Mar 4, 12:45 pm, ZeldorBlat <zeldorb...@gmail.comwrote:
On Mar 4, 12:06 pm, WPW07 <wwisnie...@gmail.comwrote:
Hello,
I have a script that lists the contents of a directory. It was
working properly until we had to change the directory that it reads
from.
The path to this script is:
/home/n/mu1/database/refresh.php.
I'd like it to list the contents in the main directory of the site:
mu1
So I have this code to list (up one level from the script):
$path = "../mu1/";
$dir_handle = opendir($path) or die("Unable to open directory $path");
But I get this error message when I try to run it:
Warning: opendir(../mu1/) [function.opendir]: failed to open dir: No
such file or directory in /home/n/mu1/database/refresh.php on line 19
Unable to open directory ../mu1/
Any idea what I'm doing wrong?
Thanks!

From your location in /home/n/mu1/database/refresh.php the value
of ../ would be the directory above /database which is /mu1. So, "../
mu1" is really /home/n/mu1/mu1/ which probably isn't what you want.
If you're inside /database you get to mu1 with ../ by itself.

Thank you. That fixed it!
Mar 4 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: bart plessers | last post by:
Hello, Currently I am developping a internet "directory browser" My page 'default.asp' has following entries: CurrentPATH = Request("MyLink") Set oFSO =...
39
by: Joe Laughlin | last post by:
If I have a character array with "/some/file/directory/file_name", are there any functions / libraries that I could use to separate the directory ("some/file/directory") from the file name...
5
by: Lloyd Dupont | last post by:
where is the webshared directory information ? I create a Webapplication called Counter in C:\IntePub\wwwroot\Counter the Counter directory was webshared under the name 'Counter'. I copied the...
6
by: varkey.mathew | last post by:
Dear all, Bear with me, a poor newbie(atleast in AD).. I have to authenticate a user ID and password for a user as a valid Active Directory user or not. I have created the IsAuthenticated...
16
by: B Letts | last post by:
Hi - I'm currently using the FileUpload control to allow people to upload files to my website. This all works fine, as long as I'm going to a physical path on my server. However, I need to...
2
by: Rose winsle | last post by:
Hi guys ... I just wanted to create virtual directory using VB.net . i can manage that ... when i create the virtual directory how can i set anonymous access off. following is my code...
6
by: titan.nyquist | last post by:
The WebBrowser control won't load a css file written in the same directory as the program. If I put an absolute path to it, it will load it. Thus, the current directory of the WebBrowser control...
4
by: stef mientki | last post by:
hello, my program has become a bit large, and now I want to split the files over several subdirectories. So in the example shown below, I just moved the files f1.py and f2.py to a deeper...
28
by: Peter Oliphant | last post by:
I have written a program using MS VS VC++ 2005 Express, /cli pure. Upon compiling it it works fine in the GUI development environment. It also works fine as a Debug stand-alone. ut I had an odd...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.