mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-13 19:44:28 +02:00
global-functions: $RmFile: fix type safeguard
Ups... 🫣 The type is not just literal 'file' - but what ever type the file is, like 'backup', 'package', 'script', '.conf file', ... So let's match those types we do *not* want to remove. Fixes: https://github.com/eworm-de/routeros-scripts/issues/90
This commit is contained in:
parent
0199ea8884
commit
dafcc1a0cb
1 changed files with 2 additions and 2 deletions
|
@ -1054,12 +1054,12 @@
|
||||||
|
|
||||||
$LogPrint debug $0 ("Removing file: ". $FileName);
|
$LogPrint debug $0 ("Removing file: ". $FileName);
|
||||||
|
|
||||||
:if ([ :len [ /file/find where name=$FileName type!=file ] ] > 0) do={
|
:if ([ :len [ /file/find where name=$FileName (type=directory or type=disk) ] ] > 0) do={
|
||||||
$LogPrint error $0 ("File '" . $FileName . "' is not a file.");
|
$LogPrint error $0 ("File '" . $FileName . "' is not a file.");
|
||||||
:return false;
|
:return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local File [ /file/find where name=$FileName type=file ];
|
:local File [ /file/find where name=$FileName !(type=directory or type=disk) ];
|
||||||
:if ([ :len $File ] = 0) do={
|
:if ([ :len $File ] = 0) do={
|
||||||
$LogPrint debug $0 ("... which does not exist.");
|
$LogPrint debug $0 ("... which does not exist.");
|
||||||
:return true;
|
:return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue