Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In DOS: Is it possible to copy a zero byte file? 2

Status
Not open for further replies.

hotfusion

Technical User
Jan 20, 2001
755
GB
I'm writing a batch file to back up the contents of an e-mail client's mail folder, and during testing I noticed that any zero byte files within the folder weren't copied. It doesn't actually matter, but it raises an interesting question: Is it possible to successfully copy zero byte files to another directory in DOS, and if so, how is it done?

Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
 
What command are you using to do the backup. I tested 'copy' and 'xcopy' and they both worked fine with copying zero byte files.
 
How strange.
I was using the COPY command, in the version of MS-DOS which shipped with WIN98SE. 33 files out of 36 copied across fine, but the remaining 3, all zero byte 'empty' files failed to do so.

I'll do some further tests to see if one empty file will copy on its own. Perhaps the outcome is influenced by the presence of other files?

Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
 
I've just tested copying an individual empty file, and it failed also. Put a couple of characters in the file and it copied fine. I used this:

COPY D:\empty.txt E:\

Which informed me that 0 files had been copied, which was correct.

Any more thoughts?


Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
 
Use xcopy. Its the command I have used for years in my backup scripts, and it should work fine. I have never seen this problem.

Matt J.

Please always take the time to backup any and all data before performing any actions suggested for ANY problem, regardless of how minor a change it might seem. Also test the backup to make sure it is intact.
 
Well, I've tried using XCOPY and it works!
All too often the solution is staring at us - it just needs someone else to point it out :)

Many thanks, mattjurado, have a star.

Regards, Andy.
**************************************
My pathetic attempts at learning HTML can be laughed at here:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top