PowerShell Compress-Archive

Copper Contributor

I have a monthly backup folder which contains daily backup from 1st day of the month to the last day of the month. How can i use PowerShell to zip each backup into the same folder or another folder all at once. I want the backup zip on a daily basis. 

Parent folder is C:\January2022>

Childitems C:\Jan-1 through Jan-30


 PS C:\Users\IT\TestFolder1> compress-Archive *.* -destinationpath C:\testfolder3\ 

Above zip all contents at once into  but i want separate childitem zip into destination.



6 Replies
Your backups are in subfolders? Or all the backup in one folder?
Is your goal to compress each subfolder to a different .zip file?
All backups are in subfolders. And my goal is to compress each subfolder to a different .zip file. with just a command or script. With that I should be able to manage many backups at once.

best response confirmed by VictorLanso (Copper Contributor)
Here you go:

Read the .Example code at the top for the parameters to use when calling the script.
Okay @raindropsdev, am on it and will feed you.

Hi @raindropsdev I Read the code, studied it and called it. It works perfectly for me and i can zip as many script as i want at once.
Thank you.
This script not only work locally, but works across domain networks to compress files and move it to the desired location on the network.