How to write powershell script function to create a zip file excluding .tmp files and bin, obj folder
I tried and found this:
function create-zip([String] $dir, [String] $Zipfile){
[string]$pathZipExe = "C:\Program Files\7-zip\7z.exe";
[Array]$arguments = "a", "-tzip", "$Zipfile", "$dir";
& $pathZipExe $arguments;
}
This code zip all file folder of the source directory but how to exclude .tmp files and "bin", "obj" folders of the source directory from zip
尝试将这些开关添加到7Zip的命令行:
[Array]$arguments = "a", "-tzip", "$Zipfile", "$dir", "-xr!bin", "-xr!obj", "-xr!*.tmp";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.