No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
SUBDIR *new*

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

5.0
5.0 | 7 ratings Rate this file 45 Downloads (last 30 days) File Size: 1.23 KB File ID: #1492 Version: 1.0

SUBDIR *new*

by

Elmar Tarajan (view profile)

 

15 Mar 2002 (Updated )

Recursively search for files and/or directorys under given folder without using of global variables.

| Watch this File

File Information
Description

SUBDIR
     returns all subfolder under current path.
  P = SUBDIR('directory_name')
      stores all subfolders under given directory into a variable 'P'

  [P F] = SUBDIR('directory_name')
      stores all subfolders under given directory into a
      variable 'P' and all filenames into a variable 'F'.
      use sort([F{:}]) to get sorted list of all filenames.

Acknowledgements

This file inspired Folders Sub Folders and Rpcode.

MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (8)
15 Nov 2015 Michala

Michala (view profile)

Great. This is what I was looking for. Quick and easy to use.

19 Feb 2015 Philip

Philip (view profile)

This doesn't work on Mac or Linux, because it assumes that '\' is the path separator. If line 36 is changed to

sub{end+1} = fullfile(CurrPath,i{:});

it should work on all platforms. You could also just replace '\' with pathsep, but fullfile is a little safer.

Comment only
06 Jan 2014 padauklan

Thank you very much for the submission. It really helps me.

Padauk

16 Aug 2013 Swati Tiwari

Thank you so much!! This really helped me :)

05 Mar 2013 Nikolay S.

Nikolay S. (view profile)

Excellent, works nicely

16 Jul 2009 Yanfei

Yanfei (view profile)

great work!!!!

26 Mar 2008 Durga Shrestha

nice work, save my time.

28 Feb 2007 martin demel

The code is optimized and you can also get the name of the files. This is excellent working.

Contact us