Getting the actual file size

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nospam@meatonconsulting.com

    #1

    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.

  • zacks@construction-imaging.com

    #2
    Re: Getting the actual file size

    On Mar 1, 8:37 am, nos...@meatonco nsulting.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.

    Comment

    • nospam@meatonconsulting.com

      #3
      Re: Getting the actual file size

      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(10 0)
      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?

      Comment

      • RobinS

        #4
        Re: Getting the actual file size

        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.
        -----------------------------
        <nospam@meatonc onsulting.comwr ote in message
        news:1172764489 .564999.33310@n 33g2000cwc.goog legroups.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(10 0)
        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?
        >

        Comment

        Working...