How can I create a string with name of a searched file?
Ältere Kommentare anzeigen
Hi,
I have some files in a directory from which I have to search and get names of files containing string "bc". So, I have this code.
file_search_with_name = strcat('dir /B /S *bc*.txt');
[status, list] = system('dir /B /S *bc*.txt');
result = textscan(list,'%s','delimiter','\n' );
files = result{1};
In files I get strings which contain the filenames with entire path, like this.
files{1,1}
ans =
C:\Users\sj028179\Documents\Work\a\abcd.txt
How can I get rid of the directory path and just keep the filename in a string, like "abcd.txt"?
Thanks for the help.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!