Delphi Determine filesize in real time -
is possible in delphi determine size of file being copied? notification when file first copied folder, need wait until copy complete before can process file.
i've used jclfileutils.getsizeoffile(filename)
gives me 'expected' file size, not current filesize.
regards, pieter
prompted first answer decided give on trying determine when file copy has completed. instead found using tfilestream
gave me reliable indication whether file in use or not.
function isfileinuse(filename: string; var resultmessage: string): boolean; var stream: tfilestream; begin result := true; resultmessage := ''; try stream := tfilestream.create(filename, fmopenread or fmsharedenywrite); try result := false; freeandnil(stream); end; except on e: exception resultmessage := 'isfileinuse: ' + e.message end; end;
in way can keep on checking until file not in use anymore before attempting process it.
Comments
Post a Comment