diff --git a/Data/scripts.csv b/Data/scripts.csv index 1af1350d..dd3c63c0 100644 --- a/Data/scripts.csv +++ b/Data/scripts.csv @@ -244,4 +244,4 @@ write-rot13.ps1, encodes or decodes the given text with ROT13 write-typewriter.ps1, writes the given text with the typewriter effect write-uppercase.ps1, writes the given text in uppercase letters write-vertical.ps1, writes the given text in vertical direction -zip-dir.ps1, creates a zip archive of the given directory +zip-dir.ps1, creates a .zip archive of the given directory diff --git a/README.md b/README.md index bc90678b..6b5b36f6 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ Mega Collection of PowerShell Scripts * [SHA1.ps1](Scripts/SHA1.ps1) - prints the SHA1 checksum of the given file * [SHA256.ps1](Scripts/SHA256.ps1) - prints the SHA256 checksum of the given file * [upload-file.ps1](Scripts/zip-dir.ps1) - uploads the local file to the given FTP server -* [zip-dir.ps1](Scripts/zip-dir.ps1) - creates a zip archive of the given directory +* [zip-dir.ps1](Scripts/zip-dir.ps1) - creates a .zip archive of the given directory 📝 Scripts for Git ------------------- diff --git a/Scripts/zip-dir.ps1 b/Scripts/zip-dir.ps1 index 6f1206f3..51937da5 100755 --- a/Scripts/zip-dir.ps1 +++ b/Scripts/zip-dir.ps1 @@ -2,7 +2,7 @@ .SYNOPSIS zip-dir.ps1 [] .DESCRIPTION - Creates a zip archive of the given directory + Creates a .zip archive of the given directory .EXAMPLE PS> .\zip-dir.ps1 C:\Windows .LINK @@ -12,15 +12,17 @@ License: CC0 #> -param([string]$Directory = "") +param([string]$directory = "") try { - if ($Directory -eq "" ) { $Directory = read-host "Enter the path to the directory to zip" } + if ($directory -eq "" ) { $directory = read-host "Enter the path to the directory to zip" } + $StopWatch = [system.diagnostics.stopwatch]::startNew() - $Directory = resolve-path $Directory - compress-archive -path $Directory -destinationPath $Directory.zip + $directory = resolve-path $directory + compress-archive -path $directory -destinationPath $directory.zip - "✔️ created zip archive: $($Directory).zip" + [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds + "✔️ created zip archive: $($directory).zip in $Elapsed sec" exit 0 } catch { write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"