searchin for an M file in all folders of my PC.

I want to search for an M file in all the folders of my PC.
I do not want to search in every folder individually.

Answers (3)

The dir command can recursively search. I think for this question it would be
d = dir("C:\**\filetofind.m")
You could consider using command line tools
[status, result] = system('dir /s *FILENAMEGOESHERE*');
Try "Everything" by voidtools: https://www.voidtools.com/
It can give you nearly instant results on where files live. Not like the Windows search utility that takes forever.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products

Release

R2025b

Asked:

on 1 Mar 2026

Edited:

on 1 Mar 2026

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!