[Tutor] Automation

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Jul 13 20:03:34 CEST 2004

On Tue, 13 Jul 2004, kumar s wrote:

>  I have ~ 50 tar gzipped files and they have thousands of files with
> .dta and .out extensions.  These files are from mass spectrometer runs.
>  I have another program that combines all the .dta files in to one large
> combined program.  Until now what I am doing is - taking one tar gzipped
> file, unzipping and untar it in to a directory. Then using the small
> program that combines all the .dta files in to one single .dta file.
> After this I am cleaning all small .dta and .out files.
> Doing this for each tar gzipped file is pain in the neck.  Is it easy to
> write a small python program? How should I write.  Please can you
> provide some help.

Hi Kumar,

Yes, you can do this kind of automation in Python.  Here are example
articles that talk about automating common system administration tasks:


You'll probably want to use some functions from the Standard Library to
call out to 'tar', and to cull out your '.dta' files. The functions:
'os.system()' and 'glob.glob()' should be helpful here:


Hope this helps!

More information about the Tutor mailing list