瀏覽代碼

Add 'openDir-d'

master
HMSheets 5 年之前
父節點
當前提交
550ae5cea9
共有 1 個文件被更改,包括 105 次插入0 次删除
  1. +105
    -0
      openDir-d

+ 105
- 0
openDir-d 查看文件

@@ -0,0 +1,105 @@
#!/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

Loading…
取消
儲存