Looks like you just need to include your slash to search in the correct directory.

import glob

mydir = "C:\Data"

file_list = glob.glob(mydir + "/*.csv") # Include slash or it will search in the wrong directory!!
print('file_list {}'.format(file_list))
Answer from Green Cell on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-use-glob-function-to-find-files-recursively-in-python
How to use Glob() Function to Find Files Recursively in Python - GeeksforGeeks
October 3, 2025 - # Python program to find files # recursively using Python import glob # Returns a list of names in list files. print("Using glob.glob()") files = glob.glob('/home/geeks/Desktop/gfg/**/*.txt', recursive = True) for file in files: print(file) ...
🌐
Real Python
realpython.com › ref › stdlib › glob
glob | Python Standard Library – Real Python
The Python glob module provides tools to find path names matching specified patterns that follow Unix shell rules.
🌐
Python
docs.python.org › 3 › library › glob.html
glob — Unix style pathname pattern expansion — Python 3.15.2 documentation
The glob module finds pathnames using pattern matching rules similar to the Unix shell. No tilde expansion is done, but *, ?, and character ranges expressed with [] will be correctly matched.
🌐
Note.nkmk.me
note.nkmk.me › home › python
How to Use glob() in Python | note.nkmk.me
July 28, 2023 - In Python, the glob module allows you to get a list or an iterator of file and directory paths that satisfy certain conditions using special characters like the wildcard *. glob — Unix style pathname ...
🌐
PYnative
pynative.com › home › python › python glob: filename pattern matching
Python Glob: Filename Pattern Matching – PYnative
June 17, 2021 - Python glob.glob() method returns a list of files or folders that matches the path specified in the pathname argument.
🌐
Built In
builtin.com › software-engineering-perspectives › glob-in-python
Glob in Python Explained | Built In
| Video: Python Tutorials for Digital Humanities · Here we have an input folder with several CSV files containing stock data. Let’s use glob to identify the files: import pandas as pd import glob # set search path and glob for files # here we want to look for csv files in the input directory path = 'input' files = glob.glob(path + '/*.csv') # create empty list to store dataframes li = [] # loop through list of files and read each one into a dataframe and append to list for f in files: # read in csv temp_df = pd.read_csv(f) # append df to list li.append(temp_df) print(f'Successfully created dataframe for {f} with shape {temp_df.shape}') # concatenate our list of dataframes into one!
🌐
W3Schools
w3schools.com › python › ref_module_glob.asp
Python glob Module
Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... import glob import tempfile import os with tempfile.TemporaryDirectory() as d: open(os.path.join(d, "Emil.txt"), "w").close() open(os.path.join(d, "Linus.txt"), "w").close() open(os.path.join(d, "Tobias.py"), "w").close() hits = glob.glob(os.path.join(d, "*.txt")) print(sorted(os.path.basename(x) for x in hits)) Try it Yourself »
Find elsewhere
🌐
datagy
datagy.io › home › file handling › use python to list files in a directory (folder) with os and glob
Use Python to List Files in a Directory (Folder) with os and glob • datagy
February 10, 2023 - Check out some other Python tutorials ... of Pivot Tables in Pandas! Glob functions similarly to the os listdir function, but you can search for all files or those matching particular conditions....
🌐
Python Module of the Week
pymotw.com › 2 › glob
glob – Filename pattern matching - Python Module of the Week
If you need a list of filenames that all have a certain extension, prefix, or any common string in the middle, use glob instead of writing code to scan the directory contents yourself.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-list-files-in-directory-with-extension
Python - List files in directory with extension - GeeksforGeeks
July 23, 2025 - It is also predicted that according ... of using operating system-dependent functionality. The method os.listdir() lists all the files present in a directory....
🌐
Real Python
realpython.com › get-all-files-in-directory-python
How to Get a List of All Files in a Directory With Python – Real Python
January 12, 2025 - For a direct list of files and folders, you use .iterdir(). The .glob() and .rglob() methods support glob patterns for filtering files with specific extensions or names. For advanced filtering, you can combine these methods with comprehensions or filter functions. By the end of this tutorial, you’ll understand that you can: List all files of a directory in Python using pathlib.Path().iterdir()
🌐
Profound Academy
profound.academy › python-mid › glob-Ljj9pCI0SAZYN6czWUGq
glob • Intermediate Python
January 21, 2025 - ['file1.txt', 'file2.txt', 'file3.txt'] <class 'list'> The glob function takes a pattern as a string and returns a list of file and directory paths that match the pattern.
🌐
TechBeamers
techbeamers.com › python-list-all-files-directory
Python List All Files in a Directory - TechBeamers
November 30, 2025 - As mentioned above, it has a walk() method which lists all files inside a directory in Python. Besides, it has another function listdir() that finds files on the specified path. Similarly, Python’s Glob module has a glob() method that checks for the specified files in the current directory.
🌐
Medium
martinxpn.medium.com › glob-working-with-files-in-python-64-100-days-of-python-31e0916f046e
Glob — Working with Files in Python (64/100 Days of Python) | by Martin Mirakyan | Medium
April 10, 2023 - Glob supports the use of wildcard characters to match files with similar names or extensions. Here are the most commonly used wildcard characters: *: Matches any string of characters, including an empty string. ... For example, let’s say you want to get a list of all files in the my_folder directory that have a .txt extension.
🌐
Michael Currin
michaelcurrin.github.io › dev-cheatsheets › cheatsheets › python › files-and-paths › glob.html
Glob | Dev Cheatsheets
glob.glob(pathname, *, recursive=False) Return a possibly-empty list of path names that match pathname, which must be a string containing a path specification. pathname · can be either absolute (like /usr/src/Python-1.5/Makefile) or relative (like ../../Tools//.gif), and can contain shell-style wildcards.
🌐
Earth Data Science
earthdatascience.org › home
Use the OS and Glob Python Packages to Manipulate File Paths | Earth Data Science - Earth Lab
November 12, 2020 - The glob function can be used to find just one folder or file. This can be done by just giving glob the path of the item you are trying to find. # Get a specific directory file_list = glob(data_folder) file_list
🌐
ChristopherGS
christophergs.com › python › 2017 › 01 › 01 › python-glob
Using Python glob
January 1, 2017 - glob.glob(pathname, *, recursive=False) The main guy: Returns a list of pathnames depending on the search criteria passed in with “pathname”
🌐
Scaler
scaler.com › home › topics › glob() in python
glob() in Python - Scaler Topics
May 4, 2023 - To produce the arbitrary values for the list of files in the output, the iglob() function of the glob module is quite helpful. With the iglob() method, a Python generator can be produced. To list the files in a given directory, we can utilize the Python generator made by the glob module.
🌐
Medium
medium.com › @tubelwj › efficient-file-searching-with-pythons-glob-module-boost-your-data-processing-speed-8b737aaff74c
Efficient File Searching with Python’s Glob Module: Boost Your Data Processing Speed | by Gen. Devin DL. | Medium
November 2, 2024 - In programming, we often need to locate all files within a directory that meet certain criteria, such as all image files or all Python files. Is there a simple and efficient way to achieve this? The answer is yes: the `glob` module.