Program that can find a find a file for you ?

Peter Hansen helten0007 at yahoo.com
Wed Sep 29 05:25:39 EDT 2004


Greetings.

Im trying to write a program that can be run from the command line.
If I want to search for example after a file with the ending .pdf, I should 
be able to write in the command line:
python  name of my program / the libary to search and what kind of file it 
is example a .pdf file
So if my program name was test.py and the library name was library1 and the 
test type i wanted to find was, a .pdf file
I should write python test.py /library1 .pdf

I have to use some of the code below, but im very lost, I know that I have 
use os, but not quite sure. Does any have any ideas.....

Thanks all

***
# -*- coding: utf-8 -*-
import sys

def useArgument(arg):


if __name__=="__main__":
"""
python argtest.py arg1 arg2 arg3
"""
if len(sys.argv)!=4:
sys.exit("Error, not the right amout of arguments")

for arg in sys.argv:
useArgument(arg)

*** 





More information about the Python-list mailing list