copy/move files..

copy/move files..

am 07.01.2008 17:22:02 von jodleren

While reading php.net I found

" bool copy ( string $source , string $dest [, resource $context ] )
Makes a copy of the file source to dest .
If you wish to move a file, use the rename() function. "

..... what? rename can move a file...?

Re: copy/move files..

am 07.01.2008 17:26:21 von luiheidsgoeroe

On Mon, 07 Jan 2008 17:22:02 +0100, jodleren wrote:

> While reading php.net I found
>
> " bool copy ( string $source , string $dest [, resource $context ] )
> Makes a copy of the file source to dest .
> If you wish to move a file, use the rename() function. "
>
> .... what? rename can move a file...?

Yes, with some caveats, quite common practice.
--
Rik Wasmus

Re: copy/move files..

am 07.01.2008 18:39:31 von Jonas Werres

> .... what? rename can move a file...?

Never used DOS?

Re: copy/move files..

am 07.01.2008 18:56:46 von giblfiz

On Jan 7, 11:22 am, jodleren wrote:
> While reading php.net I found
>
> " bool copy ( string $source , string $dest [, resource $context ] )
> Makes a copy of the file source to dest .
> If you wish to move a file, use the rename() function. "
>
> .... what? rename can move a file...?

Think of the entire folder path to the file as its name,
so if you have a file in folder /foo/bar/ named "Myfile" really how
the OS thinks of it is as a file named "/foo/bar/Myfile". if you
rename it to "/foo/BAZ/Myfile" it is now in the directory BAZ. its
"Name" for the OS has changed, even though its name for you, "Myfile"
hasn't. This is a gross oversimplification, but I think it should help
anyway.

Re: copy/move files..

am 07.01.2008 19:13:25 von ivansanchez-alg

jodleren wrote:

> .... what? rename can move a file...?

Yeah. Welcome to the wonderful world of filesystem jargon.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.

Re: copy/move files..

am 07.01.2008 19:30:28 von Courtney

jodleren wrote:
> While reading php.net I found
>
> " bool copy ( string $source , string $dest [, resource $context ] )
> Makes a copy of the file source to dest .
> If you wish to move a file, use the rename() function. "
>
> .... what? rename can move a file...?
Well it moves the directory entry, which amounts to the same thing,
unless its across a partition boundary, when it is smart enough to do a
copy instead.

Re: copy/move files..

am 07.01.2008 19:38:30 von Paul Lautman

The Natural Philosopher wrote:
> jodleren wrote:
>> While reading php.net I found
>>
>> " bool copy ( string $source , string $dest [, resource $context ] )
>> Makes a copy of the file source to dest .
>> If you wish to move a file, use the rename() function. "
>>
>> .... what? rename can move a file...?
> Well it moves the directory entry, which amounts to the same thing,
> unless its across a partition boundary, when it is smart enough to do
> a copy instead.

A copy and a delete I would hope.

Re: copy/move files..

am 07.01.2008 19:40:27 von Courtney

Paul Lautman wrote:
> The Natural Philosopher wrote:
>> jodleren wrote:
>>> While reading php.net I found
>>>
>>> " bool copy ( string $source , string $dest [, resource $context ] )
>>> Makes a copy of the file source to dest .
>>> If you wish to move a file, use the rename() function. "
>>>
>>> .... what? rename can move a file...?
>> Well it moves the directory entry, which amounts to the same thing,
>> unless its across a partition boundary, when it is smart enough to do
>> a copy instead.
>
> A copy and a delete I would hope.
>
>
Er yes..

Re: copy/move files..

am 08.01.2008 08:37:14 von jodleren

On Jan 7, 8:38=A0pm, "Paul Lautman" wrote:
> The Natural Philosopher wrote:
> > jodleren wrote:
> >> While reading php.net I found
>
> >> " bool copy ( string $source , string $dest [, resource $context ] )
> >> =A0 Makes a copy of the file source to dest .
> >> =A0 If you wish to move a file, use the rename() function. =A0 "
>
> >> .... what? rename can move a file...?
> > Well it moves the directory entry, which amounts to the same thing,
> > unless its across a partition boundary, when it is smart enough to do
> > a copy instead.
>
> A copy and a delete I would hope.

Well, since I only "move" some files (and directories) in a directory,
I do it by hand - I (may) need to keep my directory and (maybe) some
files in it.

Thanks
Sonnich