473,593 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

During copying file , wanna read file Size

During copying file , wanna read file Size like this

string CheckFileSize(s tring fileName)
{
if( fileName == null ) return;
FileInfo fi = new FileInfo(fileNa me);
return fi.Length.ToStr ing();
}

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

"somequesti on" <so**********@g mail.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
During copying file , wanna read file Size like this

string CheckFileSize(s tring fileName)
{
if( fileName == null ) return;
FileInfo fi = new FileInfo(fileNa me);
return fi.Length.ToStr ing();
}

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**********@g mail.com
wrote:
During copying file , wanna read file Size like this
string CheckFileSize(s tring fileName)
{ if( fileName == null ) return;
FileInfo fi = new FileInfo(fileNa me);
return fi.Length.ToStr ing();
}

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
7415
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 CD into a buffer and then put it into the disk. See code below. It works, but it slows down drastically before it copies all the files. Windows Task Manager shows the CPU usage gradually increasing as the files are copied, until it reaches 100...
11
3745
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 2003 Server or ADO or ODBC issue, I am posting this on all of the three newsgroups. That's the setup: Windows 2003 Server with IIS and ASP.NET actiavted Access 2002 mdb file (and yes, proper rights are set on TMP paths and path,
8
1647
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', so to do this, I have a 1px frame that refreshes every 15 seconds (so the other frame doesn't have to reload all the time--the top only reloads when a new record or a changed record hits the db). The real time data can be filtered in about 8...
10
7822
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 'to.txt' I specify where to copy it - After I read content of 'to.txt' I create one more subfolder named by current date and thats where everything gets to be copied
1
2339
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 impossible to determine if a file, once added to an archive, will cause the archive size to exceed the maximum size. I believe that to do this properly, you need to copy the state of tar file (basically the current file offset as well as the state of...
0
1301
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) as 'COUNT' from db.table group by 2 order by 1, 3; None of the columns are a primary/foreign or an index. This query
9
5200
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 facing problems: Assume that FILE* filePointer; unsigned char lineBuffer;
3
1767
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 = read( fd,buf,sizeof(buf) );
18
2380
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 DOS prompt takes only 4 seconds to do the same 128 MB copy (and a copy is both a read and write.). So why is this thing like 3x
0
7936
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8227
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6646
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5738
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3853
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3893
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1469
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.