function future = deleteFolder(pool, name)
% parallel.pool.deleteFolder deletes a subdirectory on the workers
%    F = parallel.pool.deleteFolder(POOL, SUBFOLDER) executes on each worker to delete
%    per-worker and per-host subfolders named SUBFOLDER. F is parallel.FevalOnAllFuture
%    which can be used to ensure success of the operation. It is not an error
%    if SUBFOLDER does not exist.

% Copyright 2014-2017 The MathWorks, Inc.

% Convert any string inputs to character vectors
name = convertStringsToChars(name);

validateattributes(pool, {'parallel.Pool'}, {'scalar'});
validateattributes(name, {'char'}, {'row', 'nonempty'});
if ~isvarname(name)
    error(message('parallel:pool:InvalidFolderName'));
end
future = deleteFolder(parallel.internal.pool.FolderManagement.getForPool(pool), name);
end
