Browse Source

improve megadl-all script so that it puts folders in folders

master
Alison Watson 8 months ago
parent
commit
c06c3dc3db
1 changed files with 16 additions and 1 deletions
  1. +16
    -1
      fish/megadl

+ 16
- 1
fish/megadl View File

@@ -1,7 +1,22 @@
#!/usr/bin/env fish

function megadl-all -d 'Downloads all files in ~/dl'
megadl (cat ~/dl)
for f in (cat ~/dl)
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

Loading…
Cancel
Save