Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Extract all filenames in a directory tree

Subject: Extract all filenames in a directory tree

From: spasmous

Date: 9 Jun, 2008 18:13:58

Message: 1 of 5

Is there a simple way to get all of the filenames in a directory with
paths, including the subdirectories? I'm writing a recursive dir but
it occurred to me someone has probably written a one-liner already.

Subject: Extract all filenames in a directory tree

From: us

Date: 9 Jun, 2008 18:21:02

Message: 2 of 5

spasmous:
<SNIP looking for a recursive file liste(ne)r...

there are quite a few utilities on the FEX, just look for
them...

us

Subject: Extract all filenames in a directory tree

From: spasmous

Date: 9 Jun, 2008 18:55:24

Message: 3 of 5

On Jun 9, 11:21=A0am, "us " <u...@neurol.unizh.ch> wrote:
> spasmous:
> <SNIP looking for a recursive file liste(ne)r...
>
> there are quite a few utilities on the FEX, just look for
> them...
>

Hi us. I saw a couple... meh, ugly. There must be a one line
solution ;)

Subject: Extract all filenames in a directory tree

From: us

Date: 9 Jun, 2008 19:24:01

Message: 4 of 5

spasmous:
<SNIP looking for a one-line recursive folder lister...

> There must be a one line solution...

unfortunately: NO - if you want to stay within ML...
otherwise, this might be of interest

% on a wintel system
     [r,r]=system('dir /S /B *.m');
% followed by
     r=strread(r,'%s');
% -or- (depending on what unix-flavor you have)
     [r,r]=system('ls -Rp */*.m');

us

Subject: Extract all filenames in a directory tree

From: Vihang Patil

Date: 10 Jun, 2008 06:02:08

Message: 5 of 5

spasmous <spasmous@gmail.com> wrote in message
<23f218e1-fb2b-438f-b039-1562c9956c42@s21g2000prm.googlegroups.com>...
> Is there a simple way to get all of the filenames in a
directory with
> paths, including the subdirectories? I'm writing a
recursive dir but
> it occurred to me someone has probably written a one-liner
already.
>


Hello
Try the fuf utility found on the FEX.
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=1378&objectType=file

HTH
Vihang

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us