don't lock file when calculating checksum
parent
30b137ad34
commit
ac54f66741
|
@ -211,7 +211,7 @@ Function Get-FileChecksum($path)
|
||||||
If (Test-Path -PathType Leaf $path)
|
If (Test-Path -PathType Leaf $path)
|
||||||
{
|
{
|
||||||
$sp = new-object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider;
|
$sp = new-object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider;
|
||||||
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read);
|
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
|
||||||
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
|
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
|
||||||
$fp.Dispose();
|
$fp.Dispose();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue