# -*- coding: utf-8 -*-import os
import re
from datetime import datetime
# directory="D:\\STM32CubeIDE\\STM32CubeIDE_1.0.2\\STM32CubeIDE\\features"
directory="D:\\STM32CubeIDE\\STM32CubeIDE_1.0.2\\STM32CubeIDE\\plugins"
dirBackup="D:\\STM32CubeIDE\\PluginsBackup"#This folder is a kind of recycle bin for save deleted plugins. In case you have problems running eclipse after remove them you can restore them. If you don't detect any problem you can erase this folder to save disk space
manual=False#Verifying deletion of each plugin manually (True) or automatic (False)defglobRegEx(directory,pat,absolutePath=True,type_=0):'''Function that given a directory and a regular pattern returns a list of files that meets the pattern
:param str directory: Base path where we search for files that meet the pattern
:param str pat: Regular expression that selected files must match
:param bool absolutePath: Optional parameter that indicates if the returned list contains absolute (True) or relative paths (False)
:param int type_: Type of selection 0: selects files and directories 1: only selects files 2: only selects directories
:return: a list with the paths that meet the regular pattern
'''
names=os.listdir(directory)
pat=re.compile(pat)
res=[]for name in names:if pat.match(name)