0

Im stuck on a Powershell script that has to compress all files recursively from multiple subfolders to a destination folder.

Something like this:

From:

c:\backup\user\documents\\*  
c:\backup\user2\\*  
c:\backup\new\program\\*  

To:

x:\backupfolder\file1.zip
0

1 Answer 1

3

According to PS documentation, you can use the function Compress-Archive to do this: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-6

$compress = @{
Path= "c:\backup\user\documents*", "c:\backup\user2*", "c:\backup\new\program*"
CompressionLevel = "Fastest"
DestinationPath = "x:\backupfolder\file1.zip"
}
Compress-Archive @compress
Sign up to request clarification or add additional context in comments.

1 Comment

How can i zip it using 7zip. I dont need this using compress-Archive function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.