/usr/share/psychtoolbox-3/PsychFiles/FolderFromFolder.m is in psychtoolbox-3-common 3.0.14.20170103+git6-g605ff5c.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | function [fold,nfold] = FolderFromFolder(folder,mode)
% [fold,nfold] = FolderFromFolder(folder,mode)
%
% Returns struct with all directories in directory FOLDER.
% MODE specifies whether an error is displayed when no directories are
% found (default). If MODE is 'silent', only a message will will be
% displayed in the command window, if 'ssilent', no notification will be
% produced at all.
% 2007 IH Wrote it.
% 2007 IH&DN Various additions
% 2008-08-06 DN All file properties now in output struct
% 2009-02-14 DN Now returns all folders except '..' and '.', code
% optimized
% 2010-07-02 DN Fixed typo in warning when silent and no files found, got
% rid of for loop
% 2012-06-04 DN Now also have ssilent mode for no output at all
if nargin >= 2 && strcmp(mode,'silent')
silent = 1;
elseif nargin >= 2 && strcmp(mode,'ssilent')
silent = 2;
else
silent = 0;
end
fold = dir(folder);
fold = fold([fold.isdir]);
% now skip '..' and '.', do not want to assume they are the first two
% elements returned
qremove = ismember({fold.name},{'.','..'});
fold(qremove) = [];
nfold = length(fold);
if nfold==0
if silent==1
fprintf('FolderFromFolder: No folders found in: %s\n',folder);
fold = [];
elseif ~silent
error('FolderFromFolder: No folders found in: %s',folder);
end
end
|