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 Center および File ExchangeSearch Path についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by