删除文件shell脚本备份
这个shell脚本的用处是读出url.txt的内容,url.txt内容类似于
http://www.mydomain.com/some_directory/1.html
http://www.mydomain.com/some_directory/2.html
http://www.mydomain.com/some_directory/3.html
http://www.mydomain.com/some_directory/4.html
然后把文件内容逐行读出的转化成本地路径,先备份打包,然后一起删除。
#!/bin/bash
#
# use "sed" to change url to local path. separator is ";".
#
sed -e 's;http://www.mydomain.com/some_directory/;;g' url.txt >temp
#
# loop. compress all files into a .tar file.
#
files=$(cat temp)
for file in $files
do
tar -rf url_backup_`date +%Y%m%d%H`.tar $file
rm -rf $file
echo $file
done
# end loop and delete the temporary file.
rm -rf temp
niceidea 发表于2006年08月02日 8:52 pm
什么鬼东西
看不懂