選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

83 行
2.1 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. #main script start
  19. while true; do
  20. clear
  21. title
  22. echo "Please select which options set you would like to pass to wget"
  23. echo ""
  24. echo " 1: no bots, recur, no clob, no parent"
  25. echo " 2: no bots, recur, no clob, no parent + filetypes"
  26. echo " 3: exit"
  27. #saves choice from above
  28. read choice1
  29. #checks if program should exit based off of users input
  30. if [ $choice1 == 3 ]; then
  31. clear
  32. exit
  33. elif [[ $choice1 != 1 && $choice1 != 2 && $choice1 != 3 && $choice1 != 4 ]]; then
  34. echo ""
  35. echo "ERROR: Incorrect Input. Restarting Script!"
  36. sleep 1
  37. continue
  38. fi
  39. #displays download location question
  40. echo $downDirMSG
  41. #saves choice from download location question
  42. read choice2
  43. #if y chosen then asks for new download location
  44. if [ $choice2 == "y" ]; then
  45. echo $custDownDirMSG
  46. #saves new download location
  47. read custDir
  48. downDir="-P $custDir"
  49. fi
  50. #forms wget script based off the option picked for choice1
  51. if [ $choice1 == 1 ]; then
  52. echo $dirPath
  53. read directory
  54. wget $opt3 $downDir $directory
  55. echo $completeMSG
  56. elif [ $choice1 == 2 ]; then
  57. #asks for desired filetypes to download seaperated by commas
  58. echo $fileTypeMSG
  59. read fileTypes
  60. echo $dirPath
  61. read directory
  62. wget $opt4 $fileTypes $downDir $directory
  63. echo $completeMSG
  64. else
  65. echo ""
  66. echo "ERROR: Incorrect Input. Restarting Script!"
  67. fi
  68. done
  69. #main script end
  70. #end