doni49 Posted March 5, 2007 Share Posted March 5, 2007 PHP does have read/write permissions to this folder and the files. Another PHP script CREATED most of the files that are in this folder. My head hurts! if (is_dir($dir)) { //get the directory handle if ($dh = opendir($dir)) { //get one filename at a time while (($file = readdir($dh)) !== false) { $files[] = $file; chdir($dir); //make sure $file is not a directory or the error_log file if (!is_dir($file) && !eregi ("^error_log.*$",$file)){ copy($file, $dest . $file); } } } } echo "<br>\nFiles:<pre>"; print_r ($files); echo "</pre>"; The above code outputs the following. Warning: copy(/home/donirela/.SALearn/ham/cur/tadfasafasf:2,S) [function.copy]: failed to open stream: No such file or directory in /home/donirela/public_html/SALearn.php on line 25 Files: Array ( [0] => . [1] => .. [2] => error_log [3] => tadfasafasf:2,S ) Quote Link to comment Share on other sites More sharing options...
doni49 Posted March 5, 2007 Author Share Posted March 5, 2007 UPDATE: I've continued to investigate. It SEEMS to be copying the file--but then gives that error message saying that it COULDN'T copy it. The file SAYS 0kb but then has a BUNCH of text in it when I edit the file. Quote Link to comment Share on other sites More sharing options...
btherl Posted March 5, 2007 Share Posted March 5, 2007 Which file says 0kb where and has what text in it? How are you viewing the files? Quote Link to comment Share on other sites More sharing options...
doni49 Posted March 5, 2007 Author Share Posted March 5, 2007 I'm on a hosted account w/CPanel access. I've found that after running the script, there is a file in the destination location of the same name as the original file. CP has a 'File Manager'. It tells me the file is 0kb (copy)--I'll have to double check on the size of the original file. When I click on 'Edit File' in the file mgr, it opens the file and the text that was in the original file IS there. So I guess the current Qs are: 1) why is PHP telling me that it couldn't copy is it DID copy? 2) why is CP showing 0kb when the file DOES have text in it? (This last one might be better directed at CPanel). Quote Link to comment Share on other sites More sharing options...
doni49 Posted March 6, 2007 Author Share Posted March 6, 2007 Well--I just checked CP's file manager. It shows the original as 0kb as well as the copy. Anyone have any ideas why it would tell me it was unable to copy the file when it did? It's also creating an error_log file in the source folder. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.