I have a requirement where one process continuously writes to the files in a particular folder. At the same time an another script moves the files from that folder to another folder. But files must not be moved while the first process is in the middle of writing to them. Is there any process/function in PowerShell which can fulfill this requirement?
In Powershell the syntax is like this:
$path = "C:\file.txt"
$mode = "Open"
$access = "Read"
$share = "None"
$file = [System.IO.File]::Open($path, $mode, $access, $share)
$file.close()
There is more information available on this Class at the following URL:
http://msdn.microsoft.com/en-us/library/y973b725(v=vs.110).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With