-e and unlink not finding files 
Author Message
 -e and unlink not finding files

I am building a string which contains the path and file name of a file I
wish to delete. I have $maindir which contains the complete path to my
base directory, $path which contains the name of a subdirectory where the
file that I wish to delete exists, and $num.html the file.
The problem is that the following returns a message that the file does not
exist through a browser, but when run through my shell account it says the
file does exist:
               $filepath = "$maindir/$path/$num.html";
               -e $filepath and print "$filepath file exists!<BR>\n";
               -e $filepath or print "$filepath file doesn't exists!<BR>\n";

If I replace $path with the actual directory name it works, but printing
the old $path and the new hardcoded one reveals no differences.

Unlink also seems to be unable to find the files.

Help.

Mike



Fri, 25 Feb 2000 03:00:00 GMT  
 -e and unlink not finding files


Quote:
> I am building a string which contains the path and file name of a file I
> wish to delete. I have $maindir which contains the complete path to my
> base directory, $path which contains the name of a subdirectory where
> the file that I wish to delete exists, and $num.html the file.
> The problem is that the following returns a message that the file does
> not exist through a browser, but when run through my shell account it
> says the file does exist:
>                $filepath = "$maindir/$path/$num.html";
>                -e $filepath and print "$filepath file exists!<BR>\n";
>                -e $filepath or print "$filepath file doesn't exists!<BR>\n";

Could some component of the path to the file be unreadable to the server's
uid (gid)?

Quote:
> If I replace $path with the actual directory name it works, but printing
> the old $path and the new hardcoded one reveals no differences.

(Not likely, but... Any symlinks and parent directories? chrooted server?)
Perhaps there are differences not visible to the {*filter*} eye. :-)

    sub hexified {

    }

    print "\$path is: ", hexified($path);

    print hexified($filepath, "/what/you/want/as/the/filepath");

Is that output what you wanted or not? Is everything chomped, if need be?
Hope this helps!

--
Tom Phoenix           http://www.*-*-*.com/ ~rootbeer/

Randal Schwartz Case:   http://www.*-*-*.com/
              Ask me about Perl trainings!



Fri, 25 Feb 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. unlink ( deleting file) not working

2. unlink ( deleting file) not working

3. perl scripts tries to locate specific file, getting file not found

4. Unlink Not Working On Windows Server

5. unlink() not working in NT!!??

6. unlink does not expand filename...???

7. Unrecognized sub (Last subroutine in include file not found)

8. File::Find not working

9. File::Find not recursing on Win32 Perl 5.001

10. finding files containing string x but not string y

11. find out if a file has not been accessed for 5 seconds

12. Find::File not recursing

 

 
Powered by phpBB® Forum Software