A nice, short function this one;
<# .SYNOPSIS Tests if a file is locked. #> function Test-FileLocked { param ( [string]$FilePath ) try { [IO.File]::OpenWrite($FilePath).close();return $false } catch {return $true} }
Family, Cool Stuff and Assorted Geekery; the finer things in life. Updated when I have something interesting to write :)
A nice, short function this one;
<# .SYNOPSIS Tests if a file is locked. #> function Test-FileLocked { param ( [string]$FilePath ) try { [IO.File]::OpenWrite($FilePath).close();return $false } catch {return $true} }