(self)
return True
Delete directory recursively
Delete directory recursively
Delete directory recursively
def _removedir(self):
        """Delete directory recursively"""
        try:
            for dir_path, dirs, files in os.walk(self.filename, topdown=False,
                                                 followlinks=False):
                for f_name in files:
                    f_path = dir_path + '/' + f_name
                    if not os.path.islink(f_path):
                        os.chmod(f_path, stat.S_IWUSR | stat.S_IRUSR)
                    os.unlink(f_path)
                for f_name in dirs:
                    f_path = dir_path + '/' + f_name
                    if os.path.islink(f_path):
                        os.unlink(f_path)
                        continue
                    os.chmod(f_path, stat.S_IWUSR | stat.S_IRUSR | stat.S_IXUSR)
                    os.rmdir(f_path)
            os.chmod(self.filename, stat.S_IWUSR | stat.S_IRUSR | stat.S_IXUSR)
            os.rmdir(self.filename)
        except OSError:
            Msg().err("Error: removing:", self.filename, l=Msg.VER)
            return False
        return True
def _removedir ( self ) : try : for dir_path , dirs , files in os . walk ( self . filename , topdown = False , followlinks = False ) : for f_name in files : f_path = dir_path + '/' + f_name if not os . path . islink ( f_path ) : os . chmod ( f_path , stat . S_IWUSR | stat . S_IRUSR ) os . unlink ( f_path ) for f_name in dirs : f_path = dir_path + '/' + f_name if os . path . islink ( f_path ) : os . unlink ( f_path ) continue os . chmod ( f_path , stat . S_IWUSR | stat . S_IRUSR | stat . S_IXUSR ) os . rmdir ( f_path ) os . chmod ( self . filename , stat . S_IWUSR | stat . S_IRUSR | stat . S_IXUSR ) os . rmdir ( self . filename ) except OSError : Msg ( ) . err ( "Error: removing:" , self . filename , l = Msg . VER ) return False return True