Recursive directory scripting

Will Stuyvesant hwlgw at hotmail.com
Sun Oct 13 11:33:56 EDT 2002


[drewp at bigasterisk.com]
> For example, your walkcommand can't quite do this:
> 
> for x (**/*.png) { convert $x $x:r.jpg }
> # converts all png in all subdirs to jpeg files.
> # the :r operator strips the extension of a filename (leaving the 'r'oot)
> 

I don't know if walkcommand.py can do that on linux, but it sure *can*
on Windows:
C:\doc> walkcommand ren *.png *.jpg


> 
> Bonus commands that involve subdirectories:
> 
> What python C modules support simultaneous threads?
> 
>   grep -l ALLOW_THREADS Python-2.2/**/*.c
> 
> Are there more lines (approx) of C or python in the python distribution?
> 
>   wc -l Python-2.2/**/*.c | tail -1
>   wc -l Python-2.2/**/*.py | tail -1

I didnt know the ** syntax in linux shells, learn something everyday! 
But I stopped using linux often anyway.




'''
>From listening comes wisdom and from speaking repentance.
'''



More information about the Python-list mailing list