Program that can find a find a file for you ?

Peter..... helten0007 at yahoo.com
Wed Sep 29 10:47:01 EDT 2004


Thanks for your input.

I solved the last few lines and corrected the errors that was in it.
And it does work.
Stay happy.....



"Steve" <lonetwin at gmail.com> wrote in message 
news:mailman.4077.1096467878.5135.python-list at python.org...
> Hi Peter,
>
> On Wed, 29 Sep 2004 11:25:39 +0200, Peter Hansen <helten0007 at yahoo.com> 
> wrote:
>> 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
>
> I had to do something like this sometime back so I wrote up a general
> purpose script that would look for certain types of files and call a
> python function, passing the filename as argument to the function.
> This function could be any thing that you would care to define (My
> script incidentally just rename file with *ill formed* names). This is
> roughly the equivalent doing this using the 'find' unix command:
>
> $ find -name "*.ext" -exec (some python function) {} ';'
>
> You can find the function at the ASPN cookbook site:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/300411
>
> Hope you find it useful.
>
> Regards
> Steve 





More information about the Python-list mailing list