how to access a particular format files from a drive location?

3 views (last 30 days)
hi.. In my D drive,many folders(app. 50 folders) are there.each having many formats of files.i need to access .zip files alone in each of the folders and move to separate folder..i am stuck here..

Answers (2)

David Sanchez
David Sanchez on 28 Aug 2013
The following will return a struct containing the .zip files in the folder specified by path_to_zip_files:
my_zips = dir('path_to_zip_files\*.zip')
Then,
for k=1:numel(my_zips)
my_zips(k).name
end
returns the names of the .zip files recursively. Adapt the code to your needs.
  1 Comment
sandy
sandy on 28 Aug 2013
this code showing only .zip files in Desktop alone.but many .zip files are there in locations( \test),(\Users) ...i need to access all .zip files in C DRIVE fully,not in particular path,
my_zips = dir('C:\Users\test\Desktop\*.zip');
for k=1:numel(my_zips)
my_zips(k).name
end

Sign in to comment.


David Sanchez
David Sanchez on 28 Aug 2013
Edited: Walter Roberson on 4 Sep 2013
  8 Comments
sandy
sandy on 5 Sep 2013
Edited: sandy on 18 Sep 2013
>>
mex -setup
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler: [1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2010b\sys\lcc
[0] None
Compiler: 1
Please verify your choices:
Compiler: Lcc-win32 C 2.4.1 Location: C:\PROGRA~1\MATLAB\R2010b\sys\lcc
Are these correct [y]/n? y
Trying to update options file: C:\Users\test\AppData\Roaming\MathWorks\MATLAB\R2010b\mexopts.bat From template: C:\PROGRA~1\MATLAB\R2010b\bin\win32\mexopts\lccopts.bat
Done . . .
************************************************************************ Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9 Building with the -largeArrayDims option enables the new API. ************************************************************************

Sign in to comment.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!