Powershell zip script skip files in use

Hello all,

I have a script to run a backup of a server to another.

The script is:

net use X: \\poaaps11\backup
cd X:\
Get-ChildItem .\* -include ('*.zip') -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-5))} | Remove-Item
$today_date = Get-Date -Format g
$today_date = $today_date.Substring(0,$today_date.Length-6)
$today_date = $today_date -replace "/","_"
$source = "D:\DOCUMENTOS_LOJA"
$destination = "X:\DOCUMENTOS_LOJA_APS_$today_date.zip"
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($Source, $destination)
net use X: /delete

Everything is going well, but only when there is no file in use.

If any file is in use or opened in another process, i receive an error message like this one below:

Exception calling "CreateFromDirectory" with "2" argument(s): "The process cannot access the file 'D:\DOCUMENTOS_LOJA\# AUTO SERVIÇO\# Balconistas\Leonardo Rosa\ETIQUETA EXCEL 1E MEIO.xlsx' because it is being used by another process."
At line:1 char:1
+ [io.compression.zipfile]::CreateFromDirectory($Source, $destination)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo         : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : IOException

The operation is cutting that time.

Is there any way to skip the file in use and continue with zip?

Not sure whether its possible to zip a file which is used by another process, you can give an attempt using 7z.exe