Mercurial > hg > octave-terminal
changeset 8438:ed746d578a48
improve delete
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sun, 28 Dec 2008 06:34:38 +0100 |
parents | f00578b495e9 |
children | a6b4d8fdbea1 |
files | scripts/ChangeLog scripts/miscellaneous/delete.m |
diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2008-12-28 Jaroslav Hajek <highegg@gmail.com> + + * miscellaneous/delete.m: Allow filename globs. Display warnings if + operation fails. + 2008-12-26 Francesco Potortì <pot@gnu.org> * general/prepad.m: Add reference to postpad.
--- a/scripts/miscellaneous/delete.m +++ b/scripts/miscellaneous/delete.m @@ -30,7 +30,17 @@ if (nargin == 1) if (ischar (arg)) - unlink (arg); + files = glob (arg).'; + if (isempty (files)) + warning ("delete: no such file: %s", arg); + endif + for i = 1:length (files) + file = files{i}; + [err, msg] = unlink (file); + if (err) + warning ("delete: %s: %s", file, msg); + endif + endfor elseif (all (ishandle (arg(:)))) ## Delete a graphics object. __go_delete__ (arg);