Skip to content

Commit 963cff3

Browse files
committed
create zip file
1 parent 8e05a02 commit 963cff3

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

CreateZip.ps1

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Define the zip file name and subdirectory name
2+
$zipName = "EasyQuantizationGUI.zip"
3+
$subDirName = "EasyQuantizationGUI"
4+
5+
# Get the current directory
6+
$sourcePath = (Get-Location).Path
7+
Write-Host "Current directory: $sourcePath"
8+
9+
# Create temp directory in Windows temp folder
10+
$tempDir = Join-Path $env:TEMP "EasyQuantizationGUI_temp"
11+
$tempSubDir = Join-Path $tempDir $subDirName
12+
13+
if (Test-Path $tempDir) {
14+
Remove-Item -Recurse -Force $tempDir
15+
}
16+
New-Item -Path $tempSubDir -ItemType Directory -Force | Out-Null
17+
Write-Host "Created temp directory: $tempSubDir"
18+
19+
# Copy files (excluding .git, .zip, .ps1, and README.md)
20+
$filesCopied = 0
21+
Get-ChildItem -File | Where-Object {
22+
$_.Name -ne $zipName -and
23+
$_.Name -ne "README.md" -and
24+
$_.Extension -ne ".zip" -and
25+
$_.Extension -ne ".ps1" -and
26+
$_.FullName -notlike "*.git*"
27+
} | ForEach-Object {
28+
Copy-Item $_.FullName -Destination $tempSubDir
29+
Write-Host "Copied file: $($_.Name)"
30+
$filesCopied++
31+
}
32+
33+
Write-Host "Copied $filesCopied files to temp directory"
34+
35+
# Create zip
36+
$zipPath = Join-Path $sourcePath $zipName
37+
Write-Host "Creating zip file at: $zipPath"
38+
Add-Type -Assembly "System.IO.Compression.FileSystem"
39+
[System.IO.Compression.ZipFile]::CreateFromDirectory($tempDir, $zipPath)
40+
41+
# Verify zip was created
42+
if (Test-Path $zipPath) {
43+
Write-Host "Successfully created zip file: $zipPath"
44+
} else {
45+
Write-Host "ERROR: Zip file was not created!"
46+
}
47+
48+
# Cleanup
49+
Remove-Item -Recurse -Force $tempDir
50+
Write-Host "Cleaned up temp directory"

0 commit comments

Comments
 (0)