|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- #!/usr/bin/env bash
-
- #A fancy little wget script for downloading Open Directories
-
- #preset wget options
- opt3='-e robots=off -r -nc -np'
- opt4='-e robots=off -r -nc -np --accept'
-
- #Get Current User
- user="$USER"
-
- #default download directory
- #change as needed
- downDir="-P /home/$user/Downloads/wgetDump/"
-
- #message variables
- completeMSG="Directory Download Complete!"
- downDirMSG="Do you want to change the default Download Directory? y|n"
- dirPath="Please provide the path to the file or directory you would like to download"
- autoCloseMSG="Do you want the terminal to auto close upon task completion? y|n"
- fileTypeMSG="Please provide the filetypes you would like to filter seaperated with a ','. (mkv,mp4,jpg,etc)"
- custDownDirMSG="Please provide your custom Download Directory"
-
- #EOF allows the contents inside of be displayed as is and not affect the rest of the script
- IFS='' read -r -d '' VAR <<-'EOF'
- //////////////////////////////////////////////////////////////////////////////
- \ ______ _ __ /
- \ |_ _ `. (_) | ] /
- \ .--. _ .--. .---. _ .--. | | `. \ __ _ .--. ______ .--.| | /
- \ / .'`\ \[ '/'`\ \/ /__\\[ `.-. | | | | |[ | [ `/'`\]|______|/ /'`\' | /
- \ | \__. | | \__/ || \__., | | | | _| |_.' / | | | | | \__/ | /
- \ '.__.' | ;.__/ '.__.'[___||__]|______.' [___][___] '.__.;__] /
- \ [__| /
- //////////////////////////////////////////////////////////////////////////////
- Version 1.0
- A Bash Script For Downloading Open Directories Using Wget
- Written by HMSheets
-
- -------------------------------------------------------------------------------
- EOF
-
- title() {
- echo "$VAR"
- }
-
- #main script start
- while true; do
- clear
- title
- echo "Please select which options set you would like to pass to wget"
- echo ""
-
- echo " 1: no bots, recur, no clob, no parent"
- echo " 2: no bots, recur, no clob, no parent + filetypes"
- echo " 3: exit"
-
- #saves choice from above
- read choice1
-
- #checks if program should exit based off of users input
- if [ $choice1 == 3 ]; then
- clear
- exit
- elif [[ $choice1 != 1 && $choice1 != 2 && $choice1 != 3 && $choice1 != 4 ]]; then
- echo ""
- echo "ERROR: Incorrect Input. Restarting Script!"
- sleep 1
- continue
- fi
-
- #displays download location question
- echo $downDirMSG
- #saves choice from download location question
- read choice2
-
- #if y chosen then asks for new download location
- if [ $choice2 == "y" ]; then
- echo $custDownDirMSG
- #saves new download location
- read custDir
- downDir="-P $custDir"
- fi
-
- #forms wget script based off the option picked for choice1
- if [ $choice1 == 1 ]; then
- echo $dirPath
- read directory
- wget $opt3 $downDir $directory
- echo $completeMSG
- elif [ $choice1 == 2 ]; then
- #asks for desired filetypes to download seaperated by commas
- echo $fileTypeMSG
- read fileTypes
- echo $dirPath
- read directory
- wget $opt4 $fileTypes $downDir $directory
- echo $completeMSG
- else
- echo ""
- echo "ERROR: Incorrect Input. Restarting Script!"
- fi
- done
- #main script end
-
- #end
|