Delete unnecessary subdirectory rmpath and addpath ( automatically Set Path)

4 Ansichten (letzte 30 Tage)
Jaroslav Keprt
Jaroslav Keprt am 22 Jan. 2018
Beantwortet: Jan am 22 Jan. 2018
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

Antworten (1)

Jan
Jan am 22 Jan. 2018
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);

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by