- 7Zip não suporta regex, apenas curingas. Citação do pacote manual:
7-Zip doesn't uses the system wildcard parser. 7-Zip doesn't follow the archaic rule by which . means any file. 7-Zip treats . as matching the name of any file that has an extension. To process all files, you must use a * wildcard.
- Se você estiver usando o PowerShell, provavelmente poderá fazê-lo funcionar dessa maneira:
# Get only objects with names consisting of 4 characters
[array]$Folders = Get-ChildItem -Path '.\' -Filter '????' |
# Filter folders matching regex
Where-Object {$_.PsIsContainer -and $_.Name -match '[0-9]{4}'} |
# Get full paths. Not really needed,
# PS is smart enough to expand them, but this way it's more clear
Select-Object -ExpandProperty Fullname
# Compress matching folders with 7Zip
& '7z.exe' (@('a', '-t7z', 'C:\Users\<user>\Desktop\Archive.7z') + $Folders)