473,809 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.opendi r]: 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 3035
On Mar 4, 12:06 pm, WPW07 <wwisnie...@gma il.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.opendi r]: 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...@gma il.comwrote:
On Mar 4, 12:06 pm, WPW07 <wwisnie...@gma il.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.opendi r]: 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
2212
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 = CreateObject("Scripting.FileSystemObject") Set oFolder = oFSO.GetFolder(CurrentPATH) Set oFolderContents = oFolder.Files
39
2661
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 ("file_name"). I looked at sscanf(), but that didn't seem to do what I wanted. Thanks, Joe
5
413
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 Counter directory on D: Deleted the C:\....\Counter directory (without unsharing first, *Mistake*) I tryed to webshared my new Counter directory on D: with the name Counter and I have an error message: --------------------------- Web Sharing
6
2471
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 function exactly as outlined in the below link. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT02.asp
16
11815
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 allow people to upload to a virtual directory. The directory may or may not exist on the same server as the Web site. I can't seem to figure out how to do this. If I pass the virtual
2
3912
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 ============== Dim IISSchema As New System.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/Schema/AppIsolated")
6
7552
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 isn't the current directory of the program. What is the current directory? I don't want to use an absolute path, since its contents are saved to disk, and that should always load the css file no matter where it and the css file exists. Titan
4
2181
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 subdirectory. basedirectory\ mainfile.py file1.py
28
2118
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 behavior when it comes to the Release varsion when I renamed its project directory name it was in! I tracked the problem down to it being the NAME of the DIRECTORY the application is in! Let me explain. I compiled the code, and it worked in ALL...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10635
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10378
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7653
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.