NYCPHP Meetup

NYPHP.org

[nycphp-talk] Moving a file

David Krings ramons at gmx.net
Sat Sep 23 19:37:52 EDT 2006


At 06:12 PM 9/23/2006, you wrote:
>David Krings wrote:
> > Well, the command says rename, not move_and_rename
>
>Yeah, and the mv command is called mv, not mv_and_rn. :-)
>
>Chris

Yes, but using exec to do mv works on the *nix platform. How do I know on 
which OS my script will end up one day. The PHP commands are more likely to 
behave the same and be present. I use the XAMPP on Windoze and may change 
over to a Linux server sometime soon. So, in order to make it work using mv 
I needed to write code to detect the OS and if it is not anything ending in 
nix I need to come up with an alternative.

Besides that, my point is that rename indicates that one can change the 
name of a file, but it doesn't make it even slightly obvious as that it can 
also be used to move a file as well as move and rename it at the same time. 
Many PHP commands are quite descriptive and several have one or more 
aliases. Just thought making "move()" to be an alias of "rename()" woudl be 
nice.

David K. 




More information about the talk mailing list