mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-30 15:54:56 +02:00
global-functions: $MkDir: make directory by adding file
This is new functionality in RouterOS 7.9beta4, where new file can be added with `/file/add ...`. This also creates directories for the full path.
This commit is contained in:
parent
7fdec1abed
commit
f2e8115272
1 changed files with 18 additions and 1 deletions
|
@ -558,6 +558,7 @@
|
|||
:global CleanFilePath;
|
||||
:global GetRandom20CharAlNum;
|
||||
:global LogPrintExit2;
|
||||
:global RequiredRouterOS;
|
||||
:global WaitForFile;
|
||||
|
||||
:local MkTmpfs do={
|
||||
|
@ -590,7 +591,23 @@
|
|||
:return true;
|
||||
}
|
||||
|
||||
{
|
||||
:if ([ $RequiredRouterOS $0 "7.9beta4" false ] = true) do={
|
||||
:if ([ :pick $Path 0 5 ] = "tmpfs") do={
|
||||
:if ([ $MkTmpfs ] = false) do={
|
||||
:return false;
|
||||
}
|
||||
}
|
||||
|
||||
:do {
|
||||
:local File ($Path . "/file");
|
||||
/file/add name=$File;
|
||||
$WaitForFile $File;
|
||||
/file/remove $File;
|
||||
} on-error={
|
||||
$LogPrintExit2 warning $0 ("Making directory '" . $Path . "' failed!") false;
|
||||
:return false;
|
||||
}
|
||||
} else={
|
||||
:local Error false;
|
||||
:local PathNext "";
|
||||
:foreach Dir in=[ :toarray [ $CharacterReplace $Path "/" "," ] ] do={
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue