Apr-25-2017, 08:34 AM
(This post was last modified: Apr-25-2017, 08:34 AM by AlterBlitz.)
How do I add a value from regedit for example, location of a file to glob.glob function?
I wanted to use glob.glob to read a particular folder for files with a particular extension for example .exe. The particular folder to read must be the location stored in regedit. So, How do I get it done?
In regedit the path is stored with \\ whereas in normal drive path its stored with \ ...example:
E:\\Games (Stored)\\Ubisoft\\ac3.exe -> Path stored in Regedit
E:\Games (Stored)\Ubisoft\ac3.exe -> Drive Path
I wanted to use glob.glob to read a particular folder for files with a particular extension for example .exe. The particular folder to read must be the location stored in regedit. So, How do I get it done?
from winreg import * import glob, os key = OpenKey(HKEY_CURRENT_USER, r'SOFTWARE\Ubisoft', 0, KEY_ALL_ACCESS) val = QueryValueEx(key, "ac_syndicate_exe") print(val) path = str(val) for filename in glob.iglob('path/**/*.cs', recursive=True ): print(filename)Also there's a small issue;
In regedit the path is stored with \\ whereas in normal drive path its stored with \ ...example:
E:\\Games (Stored)\\Ubisoft\\ac3.exe -> Path stored in Regedit
E:\Games (Stored)\Ubisoft\ac3.exe -> Drive Path