Show progress on file copy

Hello,

is there a way to show the current progress of a large file being copied? I found a reference to using BinaryStreams, but the reference is no longer valid :frowning:
I guess one could use a loop to transfer the data from one file to another, but wouldn’t that slow the process down (compared to just copying the file in one piece)?!?

Thanks for any help!!!

I have not seen a notification call back in any Xojo docs as yet - however if there was then it would require breaking up the file copy into chunks behind the scenes somewhere. Ultimately data transfers are broken down into chunks even if the OS has to do it or the hardware has to do it because it is not practical to completely allocate and fill huge memory buffers.

It is a trade off, yes there will be a slowdown because you have to make multiple read + write calls and update the UI with progress but then your user will be more confident that something is happening from the feedback that you give them.

[quote=36973:@Carl Clarke]I have not seen a notification call back in any Xojo docs as yet - however if there was then it would require breaking up the file copy into chunks behind the scenes somewhere. Ultimately data transfers are broken down into chunks even if the OS has to do it or the hardware has to do it because it is not practical to completely allocate and fill huge memory buffers.

It is a trade off, yes there will be a slowdown because you have to make multiple read + write calls and update the UI with progress but then your user will be more confident that something is happening from the feedback that you give them.[/quote]

The problem with implementing it yourself via a BinaryStream is that it doesn’t preserve extended attributes and other filesystem metadata.

We have plugin classes for file copy which also have progress and preserve extended file attributes.

Mac: http://www.monkeybreadsoftware.net/class-macfileoperationmbs.shtml
Windows: http://www.monkeybreadsoftware.net/class-windowsfilecopymbs.shtml

Greetings
Christian

I was assuming that the OP wanted to use BinaryStream. I guess you are suggesting using FolderItem.CopyFileTo() ? in which case there will not be any opportunity to report on progress from Xojo. Maybe the OP needs to decide if the extended attributes and metadata are important for their application. I agree that OS copies and moves are better/more efficient and I do now know enough about the OS X declares to know if the OP can use them instead of a plug-in but I am sure that someone else on the forum will know.