Delete unnecessary subdirectory rmpath and addpath ( automatically Set Path)

조회 수: 5 (최근 30일)
Jaroslav Keprt
Jaroslav Keprt 2018년 1월 22일
답변: Jan 2018년 1월 22일
addpath(genpath('X:\Library\')); Read all subdirectory % In the library are more subdirectory with \.svn % I want to delete everything subdirectory with \.svn % Examples X:\Library\1\1\.svn; X:\Library\2\1\.svn; X:\Library\1\.svn ; X:\Library\1\1\1\.svn %rmpath(genpath('X:\Library\1\1\.svn')); This command is delted everything subdirectory.
How do I automatically delete all subdirectories in .svn directories.
Exmple: rmpath(genpath('\.svn')); does not work - I wanted to delete evrything subdirectories

답변 (1개)

Jan
Jan 2018년 1월 22일
Why do you append all folders generated by genpath only to remove some folders afterwards? Simply clean up the list of folders at first:
list = genpath('X:\Library\');
folders = strsplit(list, pathsep);
folders(contains(folders, '.svn')) = [];
newlist = sprintf('%s:', folders{:});
addpath(newlist);

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by