Clear Filters
Clear Filters

list of folder path

2 views (last 30 days)
franco otaola
franco otaola on 13 Jan 2018
hello,
i couldn't find any function to obtain the different folders in the current path. for example if i do:
cwd
ans=c:/folder1/folder2/folder3
i wanted to have something like this {'C','folder1','folder2','folder3'} for the moment what i am doing to recover the 'folder3' the only one that i arrived to recover (i want to use the code with different folders paths with different folders name length so i cant read the path and cut parts with
ans(end-14:end-8)
ans='folder2'
so to recover 'folder3' with any length of folders names i made is this code:
folder=pwd;
[upperPath,~,~]=fileparts(folder);
deepestFolder=folder(length(upperPath)+2:end)
deepestFolder='folder3'
if anyone could help me with this issue i would appreciate.

Answers (0)

Categories

Find more on Get Started with MATLAB 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!