[ubuntu-uk] Python Question
Dave Hanson
dave at hansonforensics.co.uk
Fri Sep 23 14:38:35 UTC 2011
Hello Everyone,
I have scoured the web and can only find half baked answers to my question -
I'm hoping someone here can help?
I know that Python is classed as a portable programming language (it will
run on anything) So I'm wondering how do you code in such a way that your
script can just be 'ported' over to another OS?
I have this code to locate the Firefox directory:
from subprocess import Popen, PIPE
> li = Popen(['find', '/', '-iname', '*.default'],
> stdout=PIPE).stdout.read().split('\n')
> flag = 1
> for item in li:
> if item.find('firefox') != -1:
> print >>outfile, "Firefox Directory: ", item
> flag = 0
> break
It works fine on my Ubuntu machine, It won't run on a Windows machine
(haven't tested) I think because I'm calling the unix version of find and
also my path is /, obviously this would be c: in windows.
I want to search the entire disk of any OS to find the Firefox cache
directory. Is it even possible to do this? I don't particularly need the
code to do it (I don't mind if you want to share though!) What I'm really
after is - Am I wasting my time even trying?
Best Regards,
Dave Hanson
<http://hansonforensics.co.uk>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-uk/attachments/20110923/bdf93635/attachment.html>
More information about the ubuntu-uk
mailing list