You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.2 KiB

  1. #!/usr/bin/env bash
  2. #A fancy little wget script for downloading Open Directories
  3. #preset wget options
  4. opt3='-e robots=off -r -nc -np'
  5. opt4='-e robots=off -r -nc -np --accept'
  6. #Get Current User
  7. user="$USER"
  8. #default download directory
  9. #change as needed
  10. downDir="-P /home/$user/Downloads/wgetDump/"
  11. #message variables
  12. completeMSG="Directory Download Complete!"
  13. downDirMSG="Do you want to change the default Download Directory? y|n"
  14. dirPath="Please provide the path to the file or directory you would like to download"
  15. autoCloseMSG="Do you want the terminal to auto close upon task completion? y|n"
  16. fileTypeMSG="Please provide the filetypes you would like to filter seaperated with a ','. (mkv,mp4,jpg,etc)"
  17. custDownDirMSG="Please provide your custom Download Directory"
  18. #EOF allows the contents inside of be displayed as is and not affect the rest of the script
  19. IFS='' read -r -d '' VAR <<-'EOF'
  20. //////////////////////////////////////////////////////////////////////////////
  21. \ ______ _ __ /
  22. \ |_ _ `. (_) | ] /
  23. \ .--. _ .--. .---. _ .--. | | `. \ __ _ .--. ______ .--.| | /
  24. \ / .'`\ \[ '/'`\ \/ /__\\[ `.-. | | | | |[ | [ `/'`\]|______|/ /'`\' | /
  25. \ | \__. | | \__/ || \__., | | | | _| |_.' / | | | | | \__/ | /
  26. \ '.__.' | ;.__/ '.__.'[___||__]|______.' [___][___] '.__.;__] /
  27. \ [__| /
  28. //////////////////////////////////////////////////////////////////////////////
  29. Version 1.0
  30. A Bash Script For Downloading Open Directories Using Wget
  31. Written by HMSheets
  32. -------------------------------------------------------------------------------
  33. EOF
  34. title() {
  35. echo "$VAR"
  36. }
  37. #main script start
  38. while true; do
  39. clear
  40. title
  41. echo "Please select which options set you would like to pass to wget"
  42. echo ""
  43. echo " 1: no bots, recur, no clob, no parent"
  44. echo " 2: no bots, recur, no clob, no parent + filetypes"
  45. echo " 3: exit"
  46. #saves choice from above
  47. read choice1
  48. #checks if program should exit based off of users input
  49. if [ $choice1 == 3 ]; then
  50. clear
  51. exit
  52. elif [[ $choice1 != 1 && $choice1 != 2 && $choice1 != 3 && $choice1 != 4 ]]; then
  53. echo ""
  54. echo "ERROR: Incorrect Input. Restarting Script!"
  55. sleep 1
  56. continue
  57. fi
  58. #displays download location question
  59. echo $downDirMSG
  60. #saves choice from download location question
  61. read choice2
  62. #if y chosen then asks for new download location
  63. if [ $choice2 == "y" ]; then
  64. echo $custDownDirMSG
  65. #saves new download location
  66. read custDir
  67. downDir="-P $custDir"
  68. fi
  69. #forms wget script based off the option picked for choice1
  70. if [ $choice1 == 1 ]; then
  71. echo $dirPath
  72. read directory
  73. wget $opt3 $downDir $directory
  74. echo $completeMSG
  75. elif [ $choice1 == 2 ]; then
  76. #asks for desired filetypes to download seaperated by commas
  77. echo $fileTypeMSG
  78. read fileTypes
  79. echo $dirPath
  80. read directory
  81. wget $opt4 $fileTypes $downDir $directory
  82. echo $completeMSG
  83. else
  84. echo ""
  85. echo "ERROR: Incorrect Input. Restarting Script!"
  86. fi
  87. done
  88. #main script end
  89. #end