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.
 
 
 
 
 
 

25 lines
558 B

#!/usr/bin/env fish
function megadl-all -d 'Downloads all files in ~/dl' -a dl_file
if not test $dl_file
set dl_file ~/dl
end
for f in (cat $dl_file)
set folder_name ""
if string match "*/folder/*" -- $f > /dev/null
set folder_name (string sub -s24 -- $f | tr -c "[a-zA-Z0-9]" "_")
else if string match "*#F!*" -- $f > /dev/null
set folder_name (string sub -s20 -- $f | tr -c "[a-zA-Z0-9]" "_")
end
if test $folder_name
mkdir $folder_name
pushd $folder_name
end
megadl $f
if test $folder_name
popd
end
end
end
## EOF