Locate Firefox Cache - Python Code

Here I share my python code to locate firefox cache directory.


# program to locate firefox cache directory in Linux
from subprocess import Popen, PIPE

name = raw_input('Enter the top-level direcotry ( example: /home ): ')

li = Popen(['find', name, '-iname', 'cache'], stdout=PIPE).stdout.read().split('\n')

flag = 1

for item in li:
if item.find('firefox') != -1:
print 'Cache Directory: ', item
flag = 0
break

if flag:
for item in li:
if item.find('mozilla') != -1:
print 'Cache Directory: ', item
break



It will work on Linux (*nix). To use it in windows with minimum modification, you need to install UnxUtil in your machine. Please visit http://speed-dev.blogspot.com/2008/03/unxutil-run-unix-linux-command-in.html to know more about UnxUtil.

Comments

Unknown said…
Hi subeen, do you know if there is a python script that is able to increase the views of a video on youtube?
Tamim Shahriar said…
I haven't tried it yet.
Tamim Shahriar said…
I just have written a python script to increase the view count of a video in myspace. I got some hints from this site: http://icfun.blogspot.com/2008/03/bot-to-increase-myspace-video-view.html.

To write a python script to increase view count in youtube will take some time. Because of my laziness I am not going after it now, unless someone sponsors me :)
dongs said…
hey subeen in firefox how do you process a download file with a python script. i thought that firefox would send the info of the file through stdin. i am not getting anything in argv either.
Tamim Shahriar said…
Radeone, I didn't try it yet.

Popular posts from this blog

lambda magic to find prime numbers

Convert text to ASCII and ASCII to text - Python code

Adjacency Matrix (Graph) in Python