PHPverse 2025

Voting

: two plus one?
(Example: nine)

The Note You're Voting On

andrew at iwebsolutions dot co dot uk
16 years ago
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";
}
?>

<< Back to user notes page

To Top