PS-ForceCopy icon indicating copy to clipboard operation
PS-ForceCopy copied to clipboard

-BufferSize 33554432 with -BufferGranularSize 4096

Open epsitec opened this issue 1 year ago • 1 comments

The PS-ForceCopy script saved me while copying a multi-GB file.

I tried setting following options:

  • -BufferSize 33554432
  • -BufferGranularSize 4096

expecting the copy to go fast until an error is encountered, and then having the suspect part being copied by 4kB increments, yet the copy skipped 32MB of data, which were filled with zeroes, whereas running the script on the same file without these arguments produced only a hole of 4kB.

I suspect that the -BufferGranularSize 4096 option does not work as expected. Or did I miss something?

epsitec avatar Jan 02 '24 17:01 epsitec

Thank you for reporting the issue. The original idea of BufferSize was to represent the smallest readable chunk.

With addition of BufferGranularSize in #2 the meaning of BufferSize is shifted to BufferGranularSize when it is specified.

I unfortunately didn't test that PR. For now, I would leave BufferGranularSize unspecified (i.e. default: -1): it will be slower, but it should work well.

cc @zootie

PS I should probably replace BufferSize and BufferGranularSize with MinimalReadSize and ReadBuffer in a later version.

DavorJ avatar Jan 02 '24 18:01 DavorJ