示例资源列表
如url.txt:
复制代码 代码如下:
http://su.bdimg.com/static/superplus/img/logo_white_ee663702.png
http://su.bdimg.com/static/superplus/img/logo_white_ee663703.png
http://su.bdimg.com/static/superplus/img/logo_white_ee663701.png
http://su.bdimg.com/static/superplus/img/logo_white_ee663704.png
http://su.bdimg.com/static/superplus/img/logo_white_ee663705.png
http://su.bdimg.com/static/superplus/img/logo_white_ee663706.png
我们需要下载这些图片,并保存在各自的文件夹下。
脚本如下
如download.sh
复制代码 代码如下:
#!/bin/bash
# desc: download resource
# author: 十年后的卢哥哥
mydir=`pwd`
while read line
do
{
if [ -n "$line" ]
then
cd $mydir
url=$(echo "$line" | tr -d '\r')
picdir=$(echo $url | sed -r 's/http:\/\///g')
picname=$(echo ${picdir##*/})
picpath=$(echo ${picdir%/*})
mkdir -p $picpath
cd $picpath
wget -O $picname `echo $url`
fi
}
done < $1
exit 0
这里有几点要注意:
1、为了去掉文本文件中行末的换行符,要进行删除:
复制代码 代码如下:
tr -d '\r'
2、取资源名:
复制代码 代码如下:
${picdir##*/}
3、取资源路径:
复制代码 代码如下:
${picdir%/*}
运行
复制代码 代码如下:
sh download.sh url.txt
更新日志
- 邓丽君.1983-漫步人生路(2024环球MQA-UHQCD限量版)【环球】【WAV+CUE】
- 陈容森.1996-情断【上华】【WAV+CUE】
- 裘海正.1994-爱我的人和我爱的人【上华】【WAV+CUE】
- 庾澄庆.1988-错过的爱【福茂】【WAV+CUE】
- 班得瑞原装进口《第十三张新世纪专辑:旭日之丘》1CD[APE/CUE分轨][329.6MB]
- 纯音入心系列纯音乐《古筝|佛蕴|境法禅心意法自然》1CD[MP3][350MB]
- 纪钧瀚《钢琴阅读时光 雨中书店聆听轻音乐》[320K/MP3][203.44MB]
- 群星.1981-名曲65(2014环球复黑王·百代篇)【EMI百代】【WAV+CUE】
- 陈淑桦.1990-娃娃的故事【柯达】【WAV+CUE】
- 戴梅君.2011-问签诗【美华】【WAV+CUE】
- 戴梅君.2011-问签诗【美华】【WAV+CUE】
- 李国祥.1995-九五变奏【嘉音】【WAV+CUE】
- 许景淳.1992-你来自何方【全美唱片】【WAV+CUE】
- 石欣卉.2007-剧欣卉集·完整电视剧主题精丫华纳】【WAV+CUE】
- 群星.2005-LOVE情歌集VOL.5.2CD【正东】【WAV+CUE】