7zip compress files (all or with specific extension) in folder and subfolder and delete original file
Customize to your needs:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#All file types | |
Get-ChildItem C:\temp\ -Recurse -File | ForEach-Object { & "C:\Program Files\7-Zip\7z.exe" a -sdel ($_.DirectoryName+"\"+$_.Name+".7z") ($_.DirectoryName+"\"+$_.Name)} | |
#Only .bak files | |
Get-ChildItem C:\temp\*.bak -Recurse -File | ForEach-Object { & "C:\Program Files\7-Zip\7z.exe" a -sdel ($_.DirectoryName+"\"+$_.Name+".7z") ($_.DirectoryName+"\"+$_.Name)} |
Kommentarer
Send en kommentar