how to access a particular format files from a drive location?
Mostrar comentarios más antiguos
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..
Respuestas (2)
David Sanchez
el 28 de Ag. de 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 comentario
sandy
el 28 de Ag. de 2013
David Sanchez
el 28 de Ag. de 2013
Editada: Walter Roberson
el 4 de Sept. de 2013
0 votos
try the function given in the following link for recursive search:
8 comentarios
David Sanchez
el 28 de Ag. de 2013
the dir2 function provided there present a error, at least in my case. If you comment the " if ispc " condition, the recursive search works with no problem. With that part uncommented, an error message showed up regarding the mex file provided alongside the dir2.m file.
To find all your .zip files:
my_zips = dir2('your_folder','*.zip', '-r');
i think now you have all you needed
sandy
el 29 de Ag. de 2013
Cedric
el 29 de Ag. de 2013
You have to download DIR2 from the URL given in David's answer, and extract/save it somewhere in your path or in the same folder as the script that you are trying to build/run.
sandy
el 29 de Ag. de 2013
Walter Roberson
el 29 de Ag. de 2013
Which compiler are you using? What have you selected with
mex -setup
?
sandy
el 4 de Sept. de 2013
Walter Roberson
el 4 de Sept. de 2013
Please show the complete log of the compilation.
Categorías
Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!