Thursday, December 23, 2010

Cache Flash Videos (flvs) from youtube like sites

In linux, when we are viewing the flash videos in our browser (like from youtube, facebook etc), the cache of the file is usually saved in /tmp folder. When you close the browser with the video, the cached file is also removed.

There are some times when I cache those videos but forget to view it. The whole cache is gone and the next time, the video needs to be buffered again. So, this simple bash script saves the flash videos each time they are updated.


#!/bin/sh
while true
do
if [ `inotifywait -e modify /tmp 2> /dev/null| wc -l` -gt "0" ]; then
cp -R /tmp/Flash* /home/anjan/temp
fi
done;


If you don’t have inotify-tools installed, install it using

sudo apt-get install inotify-tools

No comments:

Post a Comment