get_file_size¶
- HSTB.kluster.monitor.get_file_size(filepath)¶
Not exactly sure how os.stat or os.path.getsize work, but they seem to get the total allocated size of the file and return that while the file is still copying. What we want, is the actual file size written to disk during copying.
With standard Windows file copying, we can just try open/close the file, and if that succeeds, the file is finished. With Kongsberg systems writing to disk, we can actually open and read the .all file as it copies, so the try/except is not good enough. This function will find the length of the actual readable data on disk.
- Parameters
filepath (
str) – file path to a file being written- Returns
file size in bytes
- Return type
int