使用aria2下载时处理文件

时间:2019-03-20 16:03:01

标签: bash shell directory filesystems monitoring

我会定期从Internet将zip文件夹下载到一个特定的文件夹,并且每次下载过程完成时(我使用aria2作为下载管理器来执行此操作)我想运行一个特定的bash脚本来处理数据。

关于如何进行的任何想法?我找到了一些参考,但是我对bash脚本不熟悉。顺便说一句,我正在使用Ubuntu 16.04。

例如,我有以下文件夹

enter image description here

每次下载过程完成时,我要运行script.sh

1 个答案:

答案 0 :(得分:1)

根据the documentation,aria2提供了一个名为--on-download-complete的事件挂钩:

  

事件挂钩

     

aria2提供了一些选项,可以在指定后指定任意命令   事件发生。当前提供以下选项:   --on-bt-download-complete--on-download-pause--on-download-complete--on-download-start--on-download-error--on-download-stop

因此,如果您已经提到script.sh,只需使用

aria2c --on-download-complete script.sh http://example.org/file.iso