linux下保存firefox的缓存图片

这是一个学习linuxshell编程过程中制作的小工具,废话不说。开始:
这个工具一共有两个shellscript。第一个是webimage.bash这个script的作用就是在firefox的缓存目录下递归查找JPEG文件。第二个是test_image_size.bash这个文件的作用是对webimage.bash找到的图片进行筛选。小于60000B的文件不保存。
第一个文件:webimage.bash
#!/bin/bash

#copyright by lingbofeiyun
#This shell script is to search for firefox Cache and save film to~/Videos

#change to firefox Cache directory,this may different to you ownsystem
cd /home/yxy/.mozilla/firefox/700doz1r.default/Cache

#the loops function
loops() {
for film in *
do
if [ -d $film ]  #if film is directory change tothis directory and recursion run loops
then
cd $film
loops
cd ..       #change backto parent directory
elif [ -f $film ]
then
exitcode=0
#first test the file is image or not after that calltest_image_size.bash with ll parameter
message=$(file $film|grep "JPEG") &&exitcode=$(test_image_size.bash  $(ls -l$film))
if [ "$exitcode" = 1 ]
then
cp $film /home/yxy/Pictures/Webcam
fi
fi
done
}
loops    #shellstart running
exit 0

第二个文件:test_image_size.bash
#!/bin/bash

#copyright by lingbofeiyun
#This shell script is test image file's size. If image bigger than50KB return 1,else return 0
#test the fifth parameter is greater than 60000 or not.
if [ $5 -gt 60000 ]
then
echo 1
else
echo 0
fi


这样的话运行第一个文件就会调用第二个文件。浏览完图片后运行webimage.bash图片就会保存。稍加修改就会变成保存网上的flash电影,也就是网页上看的电影。下一篇我回给出代码。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值