473,378 Members | 1,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

During copying file , wanna read file Size

During copying file , wanna read file Size like this

string CheckFileSize(string fileName)
{
if( fileName == null ) return;
FileInfo fi = new FileInfo(fileName);
return fi.Length.ToString();
}

but it shows total file size...
i just wanna read changing of file Size....
how can i get this?
Nov 28 '06 #1
2 3774

"somequestion" <so**********@gmail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
During copying file , wanna read file Size like this

string CheckFileSize(string fileName)
{
if( fileName == null ) return;
FileInfo fi = new FileInfo(fileName);
return fi.Length.ToString();
}

but it shows total file size...
i just wanna read changing of file Size....
how can i get this?
Wel, you know the length you copied,
why not simply subtract that length?

Adrian
Nov 28 '06 #2
Hi,

You need to do your own copying using Streams. For every chunk of data
written to the new file, update a byte counter that you can read when
checking file size.

The article in this link describes how to copy by transferring a byte from
one file to another, although you may want to read and write larger chunks
(multiples of 1024) using Stream.Read/Write.

http://www.java2s.com/Code/CSharp/Fi.../Copyafile.htm
On Tue, 28 Nov 2006 05:12:00 +0100, somequestion <so**********@gmail.com
wrote:
During copying file , wanna read file Size like this
string CheckFileSize(string fileName)
{ if( fileName == null ) return;
FileInfo fi = new FileInfo(fileName);
return fi.Length.ToString();
}

but it shows total file size... i just wanna read changing of file
Size....
how can i get this?


--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Bryan Rickard | last post by:
I wrote a simple program in VB6 to copy all the files from a directory on a CD-ROM to my hard disk. There are about 10 files, each about 30MB. The program uses Get and Put to get data from the...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
8
by: Phoenix | last post by:
Here's a challenge that is killing me: I've got 2 web servers and a SQL Server and about 5,000 'users' who stay connected to the site all day. I have a page that is supposed to be 'real-time',...
10
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in...
1
by: chris.atlee | last post by:
I'm writing a program in python that creates tar files of a certain maximum size (to fit onto CD/DVD). One of the problems I'm running into is that when using compression, it's pretty much...
0
by: Paul | last post by:
Hi, I seem to be having an issue with a query's results being paged out to disk during runtime. I notice in processlist it saying "Copying to tmp table on disk". select col1, col2, count(ip)...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
3
by: windstorm | last post by:
int main( void ) { int fd,size,position; char buf; char lkl = "hello,world!"; fd = creat( "test",0644 ); size = write( fd,lkl,sizeof(lkl) ); close(fd); fd = open( "test",O_RDWR ); size =...
18
by: mike3 | last post by:
Hi. I have an interesting problem. The C program presented below takes around 12 seconds to copy 128 MB of data on my machine. Yet I know the machine can go faster since a copying done at a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.