-
Notifications
You must be signed in to change notification settings - Fork 0
/
adx_bundler.ps1
50 lines (38 loc) · 1.27 KB
/
adx_bundler.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# This powershell script bundles an adx(adp/adc).
# No need to manually archive adxs anymore.
# NOTE:Put the adx_bundler.ps1 inside adx folder and right click->Run with powershell
# Created At 22-08-2022 By Prabath
# Get the folder-path
$realpath = Get-Location
# folder-name
$directoryname = (get-item $realpath).name
# bin dir path
$bpath = "$($realpath)\bin"
# adx file paths
$fpath = "$($realpath)\bin\$($directoryname).adc"
$fpath2 = "$($realpath)\bin\$($directoryname).adp"
# zipped file path
$zpath = "$($realpath)\bin\$($directoryname).zip"
# destination path of adc/adp
$adxpath = $fpath
# If the bin directory doesn't exist, create it
if(!(Test-Path $bpath)){
New-Item -Path "$($realpath)" -Name "bin" -ItemType "directory"
}
# compress files and folders to directoryname.zip
$compress = @{
Path = "$($realpath)\resources", "$($realpath)\config.xml", "$($realpath)\changelog.md", "$($realpath)\README.md"
CompressionLevel = "Fastest"
DestinationPath = $zpath
}
Compress-Archive @compress -force
# conditions to check whether the adx-folder is an adp or adc
if(Test-Path $fpath){
Remove-Item $fpath -verbose
}
if(Test-Path $fpath2){
Remove-Item $fpath2 -verbose
$adxpath = $fpath2
}
#change the file-type .zip to .adc or .adp
Rename-Item $zpath -NewName $adxpath