Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigating directory structure

Status
Not open for further replies.

RPrinceton

Programmer
Jan 8, 2003
86
US
Hi,
I have a directory tree structured as follows:
public_html
cgi-bin
data
In my Perl script I have used chdir("../"); which seems to get to get me to the public_html directory. I want to navigate to directory /public_html/data. I have tried using chdir("/data"); but it still seems to be positioned on the public_html directory. What am I doing wrong? Please advise. Thanks in advance.
Regards,
Randall Princeton
 
chdir uses sytem paths, not web root paths.

So when you say 'chdir("/data")' its trying to change to your operating system root directory and then into the data directory that does not exist there.

Better to go

chdir("~user/public_html/data");
or
chdir("../data/");
or programmatically
my $docroot = "~user/public_html/";
chdir("$docroot/data/");


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top