This article is a mirror article of machine translation, please click here to jump to the original article.

View: 3157|Reply: 0

PowerShell compresses folders based on Compress-Archive

[Copy link]
Posted on 7/27/2023 7:38:52 PM | | | |
Requirements: When using tools such as Jenkins and DevOps for automated release, you may need to back up the original program files to facilitate rollback.

[Actual combat]. NET/C# calls 7z decompression via the command line
https://www.itsvse.com/thread-10303-1-1.html

Compress-Archive: Create a compressed archive or compressed file from the specified files and directories.
The hyperlink login is visible.

Expand-Archive: Extracts a file (compressed) file from the specified archive.
The hyperlink login is visible.


Compress the F:\SaveTemp\itsvse directory with the following command:





In the actual environment, you may also need to exclude certain directories or files under the directory, such as logs, sensitive files, etc.Compress-Archive does not support the option to troubleshoot folders or files, but the exclusion can be achieved through the Get-ChildItem pipeline.

For example, exclude the Log folder with the following command:

(End)




Previous:.NET/C# Simple Use Polly tutorial
Next:Azure DevOps (VII) creates an additional agent pool
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com