Closed
Description
Good evening
If we try to Compress a directory which has locked files (e.g. C:\Portable\KeePass\KeePass.XmlSerializers.dll), then we get an "Access Denied" exception.
It's completely save to backup such files, therefore please change in Microsoft.PowerShell.Archive.psm1
$currentFileStream = [System.IO.File]::Open($currentFilePath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read)
to
$currentFileStream = [System.IO.File]::Open($currentFilePath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::Read)
so that Compress-Archive does not expect to get exclusive access to the source files.
Thanks a lot, kind regards, Thomas