note 90025 added to function.rename

From: Date: Thu, 02 Apr 2009 09:36:08 +0000
Subject: note 90025 added to function.rename
Groups: php.notes 
Request: Send a blank email to php-notes+get-152741@lists.php.net to get a copy of this message
Note that this WILL NOT WORK if trying to rename a directory to a network share. e.g. rename('/home/user/me/dir1', '/mnt/shares/nfsmount/dir2') will create a file called 'dir2' on the share and not a directory. This caught me out and my (quickest) solution was to use an exec and mv command: <?php $cmd = 'mv "/home/user/me/dir1" "/mnt/shares/nfsmount/dir2"'; exec($cmd, $output, $return_val); if ($return_val == 0) { echo "success"; } else { echo "failed"; } ---- Server IP: 87.124.35.190 Probable Submitter: 62.49.188.193 ---- Manual Page -- http://www.php.net/manual/en/function.rename.php Edit -- https://master.php.net/note/edit/90025 Del: integrated -- https://master.php.net/note/delete/90025/integrated Del: useless -- https://master.php.net/note/delete/90025/useless Del: bad code -- https://master.php.net/note/delete/90025/bad+code Del: spam -- https://master.php.net/note/delete/90025/spam Del: non-english -- https://master.php.net/note/delete/90025/non-english Del: in docs -- https://master.php.net/note/delete/90025/in+docs Del: other reasons-- https://master.php.net/note/delete/90025 Reject -- https://master.php.net/note/reject/90025 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152741) next »