Lock file while copying

Hi,

Is it possible during File.copy to lock that file from any other
process?

Thanks

Aidy

aidy wrote:

Is it possible during File.copy to lock that file from any other
process?

Not normally - unless your operating system supports Mandatory File
Locking and has it enabled.

Most OSes use Advisory File Locking, which means that a lock can be
made, but it’s up to the other process to try to lock the file itself
before updating it. It could simply not bother and go ahead with the
update anyway.