note 98569 deleted from function.rename by danbrown
| From: | danbrown@php.net | Date: | Fri, 17 Dec 2010 15:55:56 +0000 |
| Subject: | note 98569 deleted from function.rename by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175026@lists.php.net to get a copy of this message | ||
Note Submitter: cabral dot brc at gmail dot com
----
My SO: Windows
In an automatic process, I was trying to delete a file using
<?php
//(note the dot in the file's name.)
unlink("C:/my/path/my.file.txt");
?>
and I was receiving "Invalid Argument". The problem was the dot...
So, I thought I could use
<?php
rename("C:/my/path/my.file.txt","C:/my/path/myfile.txt");
?>
but again the "Invalid Argument".
So, I had to use
<?php
exec("ren \"C:/my/path/my.file.txt\" \"myfile.txt\"");
//the new name can't have the path
unlink("C:/my/path/myfile.txt");
?>