Delete unnecessary subdirectory rmpath and addpath ( automatically Set Path)

5 views (last 30 days)
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

Answers (1)

Jan
Jan on 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);

Categories

Find more on Search Path in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!