(directory)
Removes all files in the given directory.

    @param directory: The path to the directory.
Removes all files in the given directory.
Removes all files in the given directory .
def clear_dir(directory):
    """
    Removes all files in the given directory.

    @param directory: The path to the directory.
    """
    for f in os.listdir(directory):
        path = os.path.join(directory, f)
        try:
            if os.path.isfile(path):
                os.unlink(path)
            elif os.path.isdir(path):
                shutil.rmtree(path)
        except Exception as e:
            print(e)
def clear_dir ( directory ) : for f in os . listdir ( directory ) : path = os . path . join ( directory , f ) try : if os . path . isfile ( path ) : os . unlink ( path ) elif os . path . isdir ( path ) : shutil . rmtree ( path ) except Exception as e : print ( e )