Jan-22-2019, 12:28 PM
I script in bash and some expect and I am trying to make the move to python.
I have taken a beginner class at a local community college and am now trying to put "it" to use.
The best way for me to do so is to look at what I have written in bash and expect and rewrite in python.
I am working at a Centos Linux VM command line
Python 2.6.6 (I know old and crusty)
So my question :
The snip of code works well to delete any file with an extension of ".err".
For instance, I want to be able to delete any file with an extension of .err and the extension of .log
The python equivalent to the Linux command line :
Thanks in advance !!
I have taken a beginner class at a local community college and am now trying to put "it" to use.
The best way for me to do so is to look at what I have written in bash and expect and rewrite in python.
I am working at a Centos Linux VM command line
Python 2.6.6 (I know old and crusty)
So my question :
Quote:#!/usr/bin/python
import glob, os
for f in glob.glob("*.err"):
os.remove(f)
The snip of code works well to delete any file with an extension of ".err".
For instance, I want to be able to delete any file with an extension of .err and the extension of .log
The python equivalent to the Linux command line :
Quote:rm *.log *.err
Thanks in advance !!