Compress all BAK files in folder (and subfolders) with 7-Zip and delete original files

Run to fix

dir c:\temp\*.bak | ForEach-Object { & "C:\Program Files\7-Zip\7z.exe" a -sdel ($_.DirectoryName+"\"+$_.Name+".7z") ($_.DirectoryName+"\"+$_.Name)}
# To do this to all .bak files in all subfolder, just add -Recurse to command:
# dir -Recurse c:\temp\*.bak | ForEach-Object { & "C:\Program Files\7-Zip\7z.exe" a -sdel ($_.DirectoryName+"\"+$_.Name+".7z") ($_.DirectoryName+"\"+$_.Name)}

Kommentarer

Populære opslag fra denne blog

Microsoft Office 2016 and the AUTO_ACTIVATE property

Access Exchange online with Office 365 multi-factor authentication (MFA/2FA)

Disable logon and logoff events (event id 4624, 4625, 4634 (and all the other ones...))