|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-07-12 22:26 UTC] marc dot bau at gmx dot net
Description:
------------
The "rename" in PHP doesn't work as expected on Windows.
Reproduce code:
---------------
<?php
rename("C:\temp\tmp_file.txt.new", "C:\temp\tmp_file.txt");
?>
Expected result:
----------------
successful rename completed.
Actual result:
--------------
1. rename isn't working
2. C:\temp\tmp_file.txt is not replaced with C:\temp\tmp_file.txt.new
3. C:\temp\tmp_file.txt.new not moved to C:\temp\tmp_file.txt
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 12:00:01 2025 UTC |
This doesn't have anything to do with double quotes. With single quotes this isn't working, too. <?php rename('C:\temp\tmp_file.txt.new', 'C:\temp\tmp_file.txt'); ?>As already said, this won't help anything. DON'T WORK: <?php rename('C:\temp\tmp_file.txt.new', 'C:\temp\tmp_file.txt'); ?> Error: PHP Warning: rename(C:\temp\tmp_file.txt.new,C:\temp\tmp_file.txt): File exists in C:\Temp\rename-test.php on line 2 DON'T WORK: <?php rename('C:\\temp\\tmp_file.txt.new', 'C:\\temp\\tmp_file.txt'); ?> Error: PHP Warning: rename(C:\temp\tmp_file.txt.new,C:\temp\tmp_file.txt): File exists in C:\Temp\rename-test.php on line 2 DON'T WORK: <?php rename("C:\\temp\\tmp_file.txt.new", "C:\\temp\\tmp_file.txt"); ?> Error: PHP Warning: rename(C:\temp\tmp_file.txt.new,C:\temp\tmp_file.txt): File exists in C:\Temp\rename-test.php on line 2 DON'T WORK: <?php rename("C:/temp/tmp_file.txt.new", "C:/temp/tmp_file.txt"); ?> Error: PHP Warning: rename(C:/temp/tmp_file.txt.new,C:/temp/tmp_file.txt): File exists in C:\Temp\rename-test.php on line 2 So you have a Windows Box next to you? Before answering, test yourself if you don't trust me, but don't close this case until this bug has been fixed! THX.