PowerShell/Scripts/download.ps1

20 lines
497 B
PowerShell
Raw Normal View History

2020-09-29 20:35:44 +02:00
#!/snap/bin/powershell
2020-10-10 18:51:57 +02:00
2020-11-06 15:30:14 +01:00
# Syntax: ./download.ps1 [<URL>]
2020-09-29 20:35:44 +02:00
# Description: downloads the file/directory from the given URL
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
param([string]$URL)
2020-11-06 15:04:06 +01:00
if ($URL -eq "" ) {
2020-11-06 15:30:14 +01:00
$URL = read-host "Enter URL to download"
2020-11-06 15:04:06 +01:00
}
2020-10-05 13:12:12 +02:00
try {
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
2020-11-06 15:04:06 +01:00
write-host "✔️ Done."
2020-10-05 13:12:12 +02:00
exit 0
} catch { Write-Error $Error[0] }
exit 1