function checkFileStatus($filePath)
{
$fileInfo = New-Object System.IO.FileInfo $filePath
try
{
$fileStream = $fileInfo.Open([System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::Read)
$filestream.Close()
return $false
}
catch
{
return $true
}
}