Delete hidden files on unix

Philipp Pagel pDOTpagel at helmholtz-muenchen.de
Mon Mar 3 07:13:52 EST 2008


loial <jldunn2000 at googlemail.com> wrote:
> How can I delete hidden files on unix with python, i.e I want to do
> equivalent of

> rm  .lock*

Here is one way to do it:

import os, glob
for filename in glob.glob('.lock*'):
    os.unlink(filename)


Alternatively, you could also do this:

import os
os.system('rm .lock*')


cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl f. Genomorientierte Bioinformatik
Technische Universität München
http://mips.gsf.de/staff/pagel



More information about the Python-list mailing list