I solved it, maybe this help’s someone.
This script will search all files with “Archive” attribute and remove all attributes (so not only Archive, but also System, Invisible…)
Removing only Archive attribute would be unnecessarily more complicated.
I added parameters to backup job
--run-script-before-required=C:\DuplicatiScripts\BAT_calling_PowerShell.bat
--exclude-files-attributes=Archive
content of BAT_calling_PowerShell.bat file
powershell -ExecutionPolicy Bypass -File “C:\DuplicatiScripts\PowerShellScript.ps1”
Then I created PowerShell file PowerShellScript.ps1” with content:
$limit = (Get-Date).AddDays(-30)
$path = “C:\MyFolder”#view files or number
#Get-ChildItem -Path $path -Force -Recurse | Where-Object { !$.PSIsContainer -and $.CreationTime -lt $limit -and $.Attributes -eq ‘Archive’ } | Measure-Object | %{$.Count}#Set attribute Arhive for older than the $limit.
Get-ChildItem -Path $path -Force -Recurse | Where-Object { !$.PSIsContainer -and $.CreationTime -lt $limit -and $_.Attributes -eq ‘Archive’ } | Clear-ItemProperty -Name attributes
When backup job is ran, script is executed, archive attribute is cleared for old files and Duplicati will backup them.
Thanks @drwtsn32 bringing me to this idea and helped me
@JonMikelV Can you please move this topick to How-To - Duplicati category?