How to locate files in folder or directory where I'm working?
4 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I wanted to ask to see if someone could help on how I could locate files in the directory or folder where I'm working and making a logic for example if the file does not exist execute a function or process, and if it does not run.
That is, I have a function that creates an output named JS:
JSFile = strcat (partitura_xml, '_', youtube_id, '_', hashname);
For example, if I look in the folder and locate a file with the name:
Kyrie_eleison_Mozart_Requiem_Piano.xml_c0pmtmfry4U_09b5b682ceac451132efb529839115a8.js
It would not be necessary to run the process because it already exists and is identified; and instead if I do not; would have to execute the function that creates the JS me. I hope I explained well, is like making a logical process (if there is such js not process, if there is no process or call the corresponding function) and do not know how to implement or locate or find files in the folder ...
On the other hand, I wanted to ask whether take long to make that search, for example if I have 100 files or more this search would take me a lot, because in that case would have to make a database. Thanks in advanced!
0 件のコメント
回答 (2 件)
Image Analyst
2016 年 5 月 24 日
Have you tried using dir(someFilePattern) and exist(filename, 'file')?
2 件のコメント
Image Analyst
2016 年 5 月 25 日
If that does not work for you, please explain why it doesn't.
Todd Leonhardt
2016 年 5 月 25 日
The exist function should do what you want:
if 2 == exist(file name)
% Do stuff here
end
参考
カテゴリ
Help Center および File Exchange で Downloads についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!