os.execl()
Alex Martelli
aleax at aleax.it
Mon Aug 27 12:30:32 EDT 2001
"Ignacio Vazquez-Abrams" <ignacio at openservices.net> wrote in message
news:mailman.998922460.15724.python-list at python.org...
...
> Oh man, you two are doing WAY too much work. Here's my version:
>
> ---
> #! /bin/bash
>
> for i in *.tar.gz; do
> tar zxvf "$i";
> done
> ---
>
> or if you're running under DOS or Windows:
>
> ---
> @echo off
> for i in (*.tar.gz) do tar zxvf "%%i"
> ---
>
> Python is nice, but it's not always the best tool for certain tasks.
Except that it IS the best tool for MOST tasks -- e.g., this
one, if you need it to run under bash AND windows too:-).
import glob,os
for file in glob('*.tar.gz'):
os.system("tar zxvf "+file)
There -- not substantially longer than either the bash or
bat examples, AND cross-platform too:-).
Alex
More information about the Python-list
mailing list