🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #2293

Re: "file cannot be copied onto itself"

#2293
From: Bill Bochnik
Date: Mon, 17 Sep 1990 17:23
25 lines
1302 bytes
>How does the DOS "copy" command know when the source and destination file are
>one in the same (i.e., "file cannot be copied onto itself")?  I can't believe
>that it's just a string compare. The logistics of that are pretty awkward.
>

[ Stuf go bye bye]

>Then I hit this stumbling block. How do you know if you are going to try to
>write a file onto itself?  This sounds simple, but seems rather complex to me
>after trying a few things. You cannot *simply* compare the two names. That
>involves a lot of analysis as to just how the files were specified on the
>command line. There must be a better way.
>
>How does one determine that two files are indeed the same physical file?
>



How about opening the source file for reading, then open the destination file
for writing.  The second operation should return an error if the two files are
the same physical one.


-Bill
Technical Details
Message-ID: <1213@crpmks.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!world!decwrl!mips!prls!philabs!crpmks!billb
References: <2091@nyx.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!world!decwrl!mips!prls!philabs!crpmks!billb
From: billb@crpmks.UUCP (Bill Bochnik )
Newsgroups: comp.os.msdos.programmer
Subject: Re: "file cannot be copied onto itself"
Message-ID: <1213@crpmks.UUCP>
Date: 17 Sep 90 17:23:57 GMT
References: <2091@nyx.UUCP>
Reply-To: billb@crpmks.UUCP (Bill Bochnik (Info Systems))
Organization: Ciba-Geigy Corporation
Lines: 25