random scripts I use
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.

26 lines
558B

  1. #!/usr/bin/env fish
  2. function megadl-all -d 'Downloads all files in ~/dl' -a dl_file
  3. if not test $dl_file
  4. set dl_file ~/dl
  5. end
  6. for f in (cat $dl_file)
  7. set folder_name ""
  8. if string match "*/folder/*" -- $f > /dev/null
  9. set folder_name (string sub -s24 -- $f | tr -c "[a-zA-Z0-9]" "_")
  10. else if string match "*#F!*" -- $f > /dev/null
  11. set folder_name (string sub -s20 -- $f | tr -c "[a-zA-Z0-9]" "_")
  12. end
  13. if test $folder_name
  14. mkdir $folder_name
  15. pushd $folder_name
  16. end
  17. megadl $f
  18. if test $folder_name
  19. popd
  20. end
  21. end
  22. end
  23. ## EOF