linuxunixaria2

How to keep directory structure with aria2?


I need to download files simultaneously- wget doesn't support that so I want to try aria2. But I don't see an option in aria2 to keep directory structure.


Solution

  • Determine the directory structure first, then build and use a download description file:

    aria2c -i uri.txt
    

    where uri.txt might contain

    http://serverA/file1.iso http://mirror-serverB/file1.iso
    # parameters must begin with a space, otherwise it's treatened as url!
     dir=/downloads/a
    # not mandatory
     out=file1.iso
    
    http://serverA/file2.iso http://mirror-serverB/file2.iso
     dir=/downloads/b
     out=file2.iso
    

    Keep in mind that aria2 is a download util - not an sync util, like rsync or lftp.

    Referencing an rsync answer: https://stackoverflow.com/a/4147263/1163786 and an lftp answer: https://superuser.com/a/305236.