Test Powershell: Difference between revisions
Appearance
Content deleted Content added
Created page with "<syntaxhighlight lang="powershell"> Function Get-FileName($initialDirectory) { [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog $OpenFileDialog.initialDirectory = $initialDirectory $OpenFileDialog.filter = "All bz2 files (*.bz2)| *.bz2" $OpenFileDialog.ShowDialog() | Out-Null $OpenFileDialog.filename } #end function Get-FileName # *** Script MAIN *** Write-Ho..." |
No edit summary |
||
| Line 13: | Line 13: | ||
# *** Script MAIN *** |
# *** Script MAIN *** |
||
Write-Host "rebuilding MLEB bz2 to gz" |
Write-Host -BackgroundColor green "rebuilding MLEB bz2 to gz\n" |
||
Write-Host |
|||
$Pathscript = $PSScriptRoot |
$Pathscript = $PSScriptRoot |
||
$Pathbz2 = Split-Path -Parent $Pathscript |
$Pathbz2 = Split-Path -Parent $Pathscript |
||
Write-Host "scriptPath: |
Write-Host "scriptPath: $Pathscript " |
||
Write-Host "bz2Path: |
Write-Host "bz2Path: $Pathbz2 " |
||
Write-Host |
|||
$filename = Get-FileName -initialDirectory "$Pathbz2" |
$filename = Get-FileName -initialDirectory "$Pathbz2" |
||
| Line 29: | Line 31: | ||
Write-Host "converting $filename to a gz file" |
Write-Host "converting $filename to a gz file" |
||
#-split "red yellow blue green" |
#-split "red yellow blue green" |
||
Write-Host "filename: $filename" |
|||
#$filename.Split("-")[2] -Split(".tar.bz2") |
|||
#$filename.Split("-").Split(".tar.bz2") |
|||
$fdate = $filename.Split("-").Split(".tar.bz2") |
|||
| ⚫ | |||
$fdate = $fdate[1] |
|||
| ⚫ | |||
#Write-Host "Date is" $fdate |
|||
| ⚫ | |||
Write-Host " |
Write-Host "creating temp directory" |
||
| ⚫ | |||
Remove-Item $Pathbz2\temp\* -Recurse -Force |
|||
| ⚫ | |||
| ⚫ | |||
Get-Childitem -Path $Pathbz2\temp |
|||
Write-Host "unpacking $filename" tar -xvf |
|||
tar -xf $filename |
tar -xf $filename |
||
Write-Host "packing MLEB-$fdate.tar.gz" |
|||
tar -czf MLEB-$ |
tar -czf MLEB-$fdate.tar.gz INSTALL.MediaWikiLanguageExtensionBundle -C extensions * |
||
Copy-Item "MLEB-$fdate.tar.gz" -Destination "$Pathbz2" |
|||
#transfer file |
|||
} |
} |
||
#Write-Host "Write-Host" |
#Write-Host "Write-Host" |
||
| Line 44: | Line 59: | ||
#Write-Progress -Activity "Search in Progress" -Status "10% Complete:" |
#Write-Progress -Activity "Search in Progress" -Status "10% Complete:" |
||
#Write-Progress -Activity "Search in Progress" -Status "20% Complete:" |
#Write-Progress -Activity "Search in Progress" -Status "20% Complete:" |
||
Read-Host "hit enter to continue" |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||