pKarun/pKa_ostools.py
def rmr(dir):
    """Remove a dir recursively (rm -r) or if it is a file: unlink it"""
    if os.path.isdir(dir):
        for file in os.listdir(dir):
            if os.path.isdir(os.path.join(dir,file)):
                rmr(os.path.join(dir,file))
            if os.path.isfile(os.path.join(dir,file)) or os.path.islink(os.path.join(dir,file)):
                os.unlink(os.path.join(dir,file))
        if os.path.isdir(dir):
            #print 'RMDIR:',dir
            os.rmdir(dir)
        return
    else:
        os.unlink(dir)
        return
Remove a dir recursively (rm -r) or if it is a file: unlink it
Remove a dir recursively (rm -r) or if it is a file: unlink it
Remove a dir recursively ( rm - r ) or if it is a file : unlink it
def rmr(dir):
    if os.path.isdir(dir):
        for file in os.listdir(dir):
            if os.path.isdir(os.path.join(dir,file)):
                rmr(os.path.join(dir,file))
            if os.path.isfile(os.path.join(dir,file)) or os.path.islink(os.path.join(dir,file)):
                os.unlink(os.path.join(dir,file))
        if os.path.isdir(dir):
            os.rmdir(dir)
        return
    else:
        os.unlink(dir)
        return
def rmr ( dir ) : if os . path . isdir ( dir ) : for file in os . listdir ( dir ) : if os . path . isdir ( os . path . join ( dir , file ) ) : rmr ( os . path . join ( dir , file ) ) if os . path . isfile ( os . path . join ( dir , file ) ) or os . path . islink ( os . path . join ( dir , file ) ) : os . unlink ( os . path . join ( dir , file ) ) if os . path . isdir ( dir ) : os . rmdir ( dir ) return else : os . unlink ( dir ) return
Remove a dir recursively (rm -r) or if it is a file: unlink it
Remove a dir recursively ( rm - r ) or if it is a file : unlink it
"""Remove a dir recursively (rm -r) or if it is a file: unlink it""" #print 'RMDIR:',dir
dir