NYCPHP Meetup

NYPHP.org

[nycphp-talk] Moving a file

Dan Cech dcech at phpwerx.net
Sun Sep 24 08:15:27 EDT 2006


David Krings wrote:
> At 08:56 PM 9/23/2006, you wrote:
>> David Krings wrote:
>>> 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.
>> I think you might have missed my point. Twice.
>>
>> I'm not trying to suggest using the mv command (although that should
>> suffice). Rather, I'm pointing out that it can also be used to rename
>> things. These operations are the same.
>>
>> In other words, you seem to be equating a violation of your semantic
>> preferences to abuse.
>>
>> Chris
> 
> 
> That is well possible. And apparently I still don't get it. I guess we 
> better leave it at that. Thanks for trying to explain it to me.
> 
> David K. 

David,

I think the point Chris is trying to make is that 'moving' a file is
really just changing the name, in general the operations are the same.

Saying that a.txt is now named b.txt is really the same thing as saying
that /mydir1/a.txt is now named /mydir2/a.txt.

When you 'move' a file it is not actually moved unless you move it from
one drive (whether physical or logical) to another, you're just changing
the name that it is known by.  This is why 'moving' a file is more or
less instantaneous.

On a side note, if you are moving a file from one drive to another the
operation is not really a 'move', it is first copied to the destination
drive then deleted from the source drive.

Dan



More information about the talk mailing list