File.Copy missing 5KB at destination

G

Guest

I have a simple concole application. It queries a database, generates a
formatted file locally, then copies the file to a location on the network.
The file sizes are between 20MB and 60MB. The file generates fine and is
correctly formatted locally, but when it is copied (using a simple
File.Copy(src, dest, ow)) the destination file is always 5KB smaller. This
would be a nice feature except that there is data missing from the file. The
problem occurs regardless of file size or destination location. The only
difference is that it only occurs inside the original console application
(e.g. I tested copying with a new solution that took an existing file and
copied it and it worked). Debugging reveals nothing.
 
L

Lau Lei Cheong

Although it seems to be dumb question, I wish to clarify the size difference
you saw is the "actuall size" or "on disk size"?

Also, after you generates the file, did you try to "flush" the content
first? Try add Flush()(or actually a proper Close() will do)and see if it
helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top