how to find specific Folder's path ?

조회 수: 23 (최근 30일)
Shiv Nileshkumar Matliwala
Shiv Nileshkumar Matliwala 2022년 12월 2일
댓글: Jan 2022년 12월 4일
Suppose I have one folder called 'Tools Ordered'
its path is 'C:\New\Folders\Tools\Tools Ordered'
Then If I want to find this above path by only using the name 'Tools Ordered', then how can I find it ?
Can anyone suggest me any idea ?

답변 (1개)

Jan
Jan 2022년 12월 2일
이동: Jan 2022년 12월 2일
This is impossible. There could be a huge number of different locations, e.g. a public network share "\\123.234.12.167\Share\Tools Ordered". So if you do not have the additional information about the disk or that it is a local disk, a search can need too much time.
If you do know the disk:
List = dir(fullfile('C:\', '**', 'Tools Ordered', '.'));
Paths = {List.folder}
  댓글 수: 2
Shiv Nileshkumar Matliwala
Shiv Nileshkumar Matliwala 2022년 12월 2일
But what if I use the code first
path = pwd
so that it will give first the location of my current file, which is in the folder 'Tools Ordered' somewhere.
So, now is it possible that I use any function which will give me the path till 'Tools Ordered' only from 'pwd'.
Jan
Jan 2022년 12월 4일
Do you mean:
List = dir(fullfile(cd, '**', 'Tools Ordered', '.'));
Paths = {List.folder}
Note that pwd calls cd only, so you can call cd directly.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Desktop에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by