Paste Search Dynamic
import shutil
  1. from pathlib import Path
  2. import os
  3.  
  4. import shutil
  5.  
  6. list_ide_names = [
  7.     "WebStorm",
  8.     "PyCharm",
  9.     "IntelliJ",
  10.     "CLion",
  11.     "DataGrip",
  12.     "GoLand",
  13.     "PhpStorm",
  14.     "Rider",
  15.     "RubyMine",
  16. ]
  17. # .WebStorm2019.2
  18.  
  19. home = Path.home()
  20.  
  21. all_ide = []
  22. for ide_name in list_ide_names:
  23.     files = os.scandir(home)
  24.     for file in files:
  25.         if ide_name.lower() in file.name.lower():
  26.             all_ide.append((ide_name, os.path.join(file.path, "config")))
  27.  
  28. print(all_ide)
  29.  
  30. for ide_name, ide_config_folder in all_ide:
  31.     try:
  32.         p = ide_config_folder + os.sep + "eval"
  33.         shutil.rmtree(p)
  34.     except:
  35.         pass
  36.  
  37.     try:
  38.         p = os.path.join(ide_config_folder, "config", "other.xml")
  39.         os.remove(p)
  40.     except:
  41.         pass
  42.  
  43.     try:
  44.         cmd = r'reg delete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\jetbrains\%s" /f' % ide_name.lower()
  45.         os.system(cmd)
  46.     except:
  47.         pass
Parsed in 0.010 seconds