From: J. P. Gilliver (John) on
In message <OaWOX88XKHA.1372(a)TK2MSFTNGP02.phx.gbl>, Richard
<richard(a)avbtab.org> writes:
>
>> "J. P. Gilliver (John)" <G6JPG(a)soft255.demon.co.uk> wrote in message
>> news:Ta5FQGaKTB5KFwoY(a)soft255.demon.co.uk...
>> I know one way to join files: in a command box,
>>
>> copy /b filea+fileb filec
>>
>> . However, if filea is huge, this takes a noticeable time, because
>> the entirety of filea is copied to filec (followed by fileb,
>> obviously). I know with text files, you can just append things to
>> another file - e. g.
>>
>> dir >> filea
>>
>> will I think append a directory listing to filea, or
>>
>> type fileb >> filea
>>
>> will append fileb to filea - but only if it's a text file.
>>
>> Anyone know how to concatenate arbitrary files, without involving a third
>> file?
>
>To append fileB to fileA:
>
>copy /b fileA+fileB fileA
>
>FWIW. --Richard
>
>
>
Won't that still go through the motions of copying every byte of fileA,
even if it's putting the results back in the same place?
--
J. P. Gilliver. UMRA: 1960/<1985 MB++G.5AL-IS-P--Ch++(p)Ar(a)T0H+Sh0!:`)DNAf
** http://www.soft255.demon.co.uk/G6JPG-PC/JPGminPC.htm for ludicrously
outdated thoughts on PCs. **

Archduke Ferdinand found alive - First World War a mistake!
From: Jim on
I've been following this correspondence with interest, since, for a reason
which escapes me now, I used to append one text file to another back in the
days of DOS.

However, one thing escapes me : apart from text files (under which term I
include program source code and anything else in text), what would be the
point of appending one file to another?

Jim


From: Richard on
>>> "J. P. Gilliver (John)" <G6JPG(a)soft255.demon.co.uk> wrote in message
>>> news:Ta5FQGaKTB5KFwoY(a)soft255.demon.co.uk...
>>> I know one way to join files: in a command box,
>>>
>>> copy /b filea+fileb filec
>>>
>>> . However, if filea is huge, this takes a noticeable time, because
>>> the entirety of filea is copied to filec (followed by fileb,
>>> obviously). I know with text files, you can just append things to
>>> another file - e. g.
>>>
>>> dir >> filea
>>>
>>> will I think append a directory listing to filea, or
>>>
>>> type fileb >> filea
>>>
>>> will append fileb to filea - but only if it's a text file.
>>>
>>> Anyone know how to concatenate arbitrary files, without involving a
>>> third file?
>>
>> In message <OaWOX88XKHA.1372(a)TK2MSFTNGP02.phx.gbl>, Richard
>> <richard(a)avbtab.org> writes:
>>
>> To append fileB to fileA:
>>
>> copy /b fileA+fileB fileA
>>
>> FWIW. --Richard
>>
>>
>>

> "J. P. Gilliver (John)" <G6JPG(a)soft255.demon.co.uk> wrote in message
> news:H+xAZsK6Nh9KFwI$@soft255.demon.co.uk...
>
> Won't that still go through the motions of copying every byte of fileA,
> even if it's putting the results back in the same place?

Hi again John,

(Actually, I used such small test files it was too fast to tell. :)

Here's the output of my 2 tests:
C:\>copy /a test1.txt+test2.txt test1.txt
test1.txt
test2.txt
1 file(s) copied.

C:\>type test1.txt
This is test1...
This is test2...

C:\>copy /a test1.txt+test2.txt+test3.txt test1.txt
test1.txt
test2.txt
test3.txt
1 file(s) copied.

C:\>type test1.txt
This is test1...
This is test2...
This is test2...
This is test3...

Note that it says only "1 file(s) copied."

(We need bigger guns... :)

Made a copy of a 120MB exe file as trial1.exe (took more than 2 seconds)
Made a copy of a 5MB exe file as trial2.exe (took less than a second)
C:\>copy /b trial1.exe+trial2.exe trial1.exe

took less than a second to append 5MB to 120MB file to get 125MB
Deleted both trial*.exe files.

Copied 120MB exe file as trial1.exe again
Copied 5MB exe file as trial2.exe again
C:\>copy /b trial2.exe+trial1.exe trial2.exe

took more than 2 seconds to append 120MB file to 5MB file to get 125MB
Deleted both trial*.exe files.

That proves that when appending the small to the large file, the large file
was not re-copied into itself, but the 2nd file was only added on the end.

HTH. (Hope This Helps. :)
--Richard

- - -
Special Veteran's Day Remembrance
http://www.avbtab.org/rc/veterans.htm