473,396 Members | 2,020 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,396 software developers and data experts.

Getting the actual file size

I am trying to monitor the process of a file being copied, but I
cannot find a function that will return the actual file size, not the
total file size, as reported by fileinfo.length. Has anyone ever done
something like this before? I would rather do this instead of trying
to open the file exclusively.

Mar 1 '07 #1
3 3442
On Mar 1, 8:37 am, nos...@meatonconsulting.com wrote:
I am trying to monitor the process of a file being copied, but I
cannot find a function that will return the actual file size, not the
total file size, as reported by fileinfo.length. Has anyone ever done
something like this before? I would rather do this instead of trying
to open the file exclusively.
The only reason why the "actual size" is larger than the "total file
size" is that the total file size reflects actually how much data is
in the file. The actual file size on disk is determined by the cluster
factor for the disk volume the file is stored on and is essentially
overhead you don't need to worry about when copying a file.

Mar 1 '07 #2
Thanks, but let me explain a little more as to what I am trying to do.

I monitor a directory for new files, but because the file sizes are so
larger that are getting copied, I do not want to process as soon as
they are created. Therefore, I want to create a small loop that goes
something like this:

Do until ActualFileSize = fileinfo.length
ActualFileSize = (function to check size)
thread.sleep(100)
Loop

So if a 60 mb file is copied, I want to monitor the progress. Actual
file size would grow as the file is being copied... 1k, 15k, 25k....
60mb complete. Does this make sense?

Mar 1 '07 #3
I think most people handle that by doing something like this:

Try
open the file
Catch
you can't open it, so it's not finished copying
sleep, or use a timer to wait a few seconds before trying again

Robin S.
-----------------------------
<no****@meatonconsulting.comwrote in message
news:11*********************@n33g2000cwc.googlegro ups.com...
Thanks, but let me explain a little more as to what I am trying to do.

I monitor a directory for new files, but because the file sizes are so
larger that are getting copied, I do not want to process as soon as
they are created. Therefore, I want to create a small loop that goes
something like this:

Do until ActualFileSize = fileinfo.length
ActualFileSize = (function to check size)
thread.sleep(100)
Loop

So if a 60 mb file is copied, I want to monitor the progress. Actual
file size would grow as the file is being copied... 1k, 15k, 25k....
60mb complete. Does this make sense?

Mar 1 '07 #4

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

Similar topics

15
by: middletree | last post by:
How do I request the actual page name that I'm on? This is going to go into an include file, and depending on which page I'm on, I'd like to do different things. I'm looking for "pagename.asp"
17
by: Arnold | last post by:
Is using fseek and ftell a reliable method of getting the file size on a binary file? I thought I remember reading somewhere it wasn't... If not what would be the "right" and portable method to...
1
by: Ron Vecchi | last post by:
I am using asp.net to upload an image and then perform resizing on it and saving the different sizes to file. The resized images were coming up and being displayed in the bowser fine but the image...
5
by: IcingDeath via DotNetMonster.com | last post by:
I am building this SQL Server database app in which i can store files. In order to display files I want to have the app show the associated icon for the extension of the file that is in the...
3
by: Linh Luong | last post by:
Hi All, 1. I have been reading and the max size of a tuple is 8K. I have also read that I can it to a larger size in some config file. Where is this file? is it called pg_config.h and is the...
2
by: abrtlt | last post by:
I am using Ajax with a PHP script to obtain the name of gif files from a MySQL database. Javascript then embeds the actual file in the web page, thus displaying the image on the fly. For precise...
3
by: Andrzej | last post by:
I have a picturebox on my C# .NET form. The picturebox size mode is set to zoom. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and...
9
vikas251074
by: vikas251074 | last post by:
I am not getting date value in spite of my good effort. This code was working in my last office where I work. Now I am trying to work at my home pc. but not getting date value. Any can help me why...
7
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.