in reply to Files on a Win2000 server

A common problem in situations where you don't have shell access, and have to upload CGI scripts and data files via FTP, is that things aren't where you think they are when the script executes.

One brute-force way of determining what is there is to upload a test CGI that does

use Cwd; print "Content-type: text/plain\n\n"; print getcwd(), "\n\n"; opendir(DIR, ".") or die ".: $!"; print join("\n", readdir(DIR)), "\n"; closedir(DIR);
The will tell you where the script thinks it is when executing, and what else is there. You may find that you need to either chdir() or use an absolute path to open data files that reside elsewhere.

Replies are listed 'Best First'.
Re: Files on a Win2000 server
by Anonymous Monk on Feb 25, 2002 at 02:14 UTC
    Thank you! Apparantly the working directory was C:/WINNT instead of my location on the server. I always thought the wd was the directory where the script is being executed unless changed in the script. Guess not. Thanks for the useful bit of code, dws. A specific chdir() has healed all wounds.
    X