By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,122 Members | 1,555 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,122 IT Pros & Developers. It's quick & easy.

Getting the actual file size

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.