VOGONS

Common searches


copy command

Topic actions

First post, by Goober

User metadata

Using dosbox 0.63 on Windows XP. The following command -- "copy file.txt file.txt.bak" -- assuming file.txt exists, does not create file.txt.bak, and overwrites file.txt with a zero byte file. Okay, so now I know the two names are seen as equivalent, stupid me, but wouldn't it be better if instead of overwriting the file copy exited and spit out an error message?

Reply 1 of 10, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

It would be best to replicate whatever the behavior is in old versions of DOS. The reason this happens it that, just like pure DOS, DOSBox doesn't support long filenames (filenames that don't fit into the mold of having 8 characters, one period, and three more characters). I don't know if classic DOS would have complained about copying a file over itself or not...

Reply 2 of 10, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Ok in DosBox:

Copy file.txt file.txt.bak

you end up with the original file being overwritten with a 0 byte file.

In Window 98 DOS 7

Copy file.txt to file.txt.bak

you get this error message "File Not Found file.txt.bak".

Also DOS 7 cannot copy a file onto itself. If you do a

copy file.txt to file.txt

The error message is "File cannot be copied onto itself".

DOS doesn't like more than 1 period in a filename.

So yeah DosBox shouldn't overwrite a file with a 0byte file, it should complain just like Real DOS.

DOSBox Compilation Guides
DosBox Feature Request Thread
PC Game Compatibility List
How To Ask Questions The Smart Way
Running DRM games offline

Reply 3 of 10, by jal

User metadata
Rank Oldbie
Rank
Oldbie
DosFreak wrote:

So yeah DosBox shouldn't overwrite a file with a 0byte file, it should complain just like Real DOS.

Iirc, such a warning didn't exist in DOS 6.2 or below (DOSbox tries to emulate 5.0), so yes, DOSbox should emulate 'real DOS', but not DOS 7 or above.

JAL

Reply 4 of 10, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

I'll test that out but I'd consider DOS 7 just as much DOS as DOS 6.2...moreso since it's the latest MS-DOS. I definetly don't consider overwriting files with 0byte ones a good thing....I could just be crazy tho.

DOSBox Compilation Guides
DosBox Feature Request Thread
PC Game Compatibility List
How To Ask Questions The Smart Way
Running DRM games offline

Reply 5 of 10, by jal

User metadata
Rank Oldbie
Rank
Oldbie
DosFreak wrote:

I'll test that out but I'd consider DOS 7 just as much DOS as DOS 6.2...moreso since it's the latest MS-DOS. I definetly don't consider overwriting files with 0byte ones a good thing....I could just be crazy tho.

DOS 7 may be the latest version, but it's enhanced in many ways compared to DOS 5.0 or 6.2. And like I said, iirc Qbix has many times stated that it is DOSbox' aim to emulate DOS 5.0. Overwriting files may not be a good thing, but if that's what DOS 5.0 does, it is not per se a bad thing to implement.

JAL

Reply 6 of 10, by 3803

User metadata
Rank Newbie
Rank
Newbie
DosFreak wrote:

I definetly don't consider overwriting files with 0byte ones a good thing....I could just be crazy tho.

Suppose that some batch files make use of this behavior, things wouldn't work right. Anyway, most dos games (and apps) are not written with DOS 7 in mind so I think it's good the way it is now.

Reply 8 of 10, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Show me a batch file demonstrating copying one file over the same filename.......and not some made up one either.

DOSBox Compilation Guides
DosBox Feature Request Thread
PC Game Compatibility List
How To Ask Questions The Smart Way
Running DRM games offline

Reply 9 of 10, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Alright, just tested with MSDOS 5 and 6.22 boot disks.

Result:

"File cannot be copied on itself."

There. It's in 5.00, therefore it's a bug in DosBox. Geesh.

DOSBox Compilation Guides
DosBox Feature Request Thread
PC Game Compatibility List
How To Ask Questions The Smart Way
Running DRM games offline

Reply 10 of 10, by jal

User metadata
Rank Oldbie
Rank
Oldbie
DosFreak wrote:

Alright, just tested with MSDOS 5 and 6.22 boot disks.
"File cannot be copied on itself."
There. It's in 5.00, therefore it's a bug in DosBox. Geesh.

Thank you DosFreak, that's all we wanted to know 😀.

JAL