Python Forum
Adding regedit value to glob.glob
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding regedit value to glob.glob
#1
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?

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
Reply


Messages In This Thread
Adding regedit value to glob.glob - by AlterBlitz - Apr-25-2017, 08:34 AM
RE: Adding regedit value to glob.glob - by nilamo - May-18-2017, 09:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  |SOLVED] Glob JPGs, read EXIF, update file timestamp? Winfried 5 3,953 Oct-21-2021, 03:29 AM
Last Post: buran
  [SOLVED] Input parameter: Single file or glob? Winfried 0 2,050 Sep-10-2021, 11:54 AM
Last Post: Winfried
  q re glob.iglob iterator and close jimr 2 3,256 Aug-23-2021, 10:14 PM
Last Post: perfringo
  Listing files with glob. MathCommander 9 8,698 Oct-26-2020, 02:04 AM
Last Post: MathCommander
  Adding markers to Folium map only adding last element. tantony 0 2,885 Oct-16-2019, 03:28 PM
Last Post: tantony
  Version of glob for that Supports Windows Wildcards? Reverend_Jim 5 7,186 Jun-18-2019, 06:31 PM
Last Post: Reverend_Jim
  nested for loops glob devenuro 3 6,396 Sep-20-2018, 09:54 PM
Last Post: ODIS
  Glob and automating help Thunberd 0 2,823 Jun-13-2018, 04:42 PM
Last Post: Thunberd
  Issues with running regedit command from python gohanzdad 10 12,007 May-16-2017, 04:28 PM
Last Post: gohanzdad
  glob for dir listing bluefrog 5 5,677 Mar-07-2017, 05:46 PM
Last Post: bluefrog

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020