查看文章
 
adobe flash现在不在/tmp下存flash文件了,改在cache下存了怎么办呢(解决方案贴出来)
2011-02-15 18:24

转载自OMG Ubuntu,我知道这网站国内被墙了所以贴出来方便点(其实是给你自己方便吧!)

 

#!/bin/bash
#
# FLASHCOPY
#
# Will ieterate through all open copies flashplayer and copy flash video to the
# current folder (or specified directory) with the .flv extension added.

args=("$@")

args=`echo $args | sed 's/[/]$//'`

pids=`eval pgrep -f flashplayer`
for pid in $pids
do
lsoutput=$(lsof -p $pid | grep '/tmp/Flash[^ ]*')

IFS=$'\n'
for line in $lsoutput; do
lsout1=`echo $line | awk '{print "/proc/" $2 "/fd/" $4}' | sed 's/[rwu]$//'`
lsout2=`echo $line | awk '{print $9}' | awk -F '/' '{print $3}'`

if [ -n "$args" ];then
if [ -d $args ]; then
echo "Copying $lsout2 to $args/"
eval "cp $lsout1 $args/$lsout2.flv"
else
echo "The directory \"$args\" doesn't exist"
break
fi
else
echo "Copying $lsout2"
eval "cp $lsout1 $lsout2.flv"
fi

done
done

 

 

 

稍微说下原理,运行中的进程其实都在/proc里,所以根据/proc加上pid下的文件夹就能找到当前正在产生的缓存文件。熟悉awk语言的不难懂。(不熟悉也没关系)

 

使用方法,在youtube窗口开着的时候,运行bash flashcopier.sh (内容就是上面那些),会保存到当前文件夹下,如果运行bash flashcopier.sh ~/Videos 则拷贝到~/Videos文件夹下,非常简单吧!


类别:计算机与 internet||添加到搜藏 |分享到i贴吧|浏览(189)|评论 (0)
 
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
     

   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu