mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: $MkDir: add extra block for indention...
... to make the next commit cleaner. No functional change.
This commit is contained in:
@ -590,40 +590,42 @@
|
|||||||
:return true;
|
:return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Error false;
|
{
|
||||||
:local PathNext "";
|
:local Error false;
|
||||||
:foreach Dir in=[ :toarray [ $CharacterReplace $Path "/" "," ] ] do={
|
:local PathNext "";
|
||||||
:local Continue false;
|
:foreach Dir in=[ :toarray [ $CharacterReplace $Path "/" "," ] ] do={
|
||||||
:set PathNext [ $CleanFilePath ($PathNext . "/" . $Dir) ];
|
:local Continue false;
|
||||||
|
:set PathNext [ $CleanFilePath ($PathNext . "/" . $Dir) ];
|
||||||
|
|
||||||
:if ([ :len [ /file/find where name=$PathNext !(name="tmpfs") type="directory" ] ] = 1) do={
|
:if ([ :len [ /file/find where name=$PathNext !(name="tmpfs") type="directory" ] ] = 1) do={
|
||||||
:set Continue true;
|
:set Continue true;
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ($Continue = false && $PathNext = "tmpfs") do={
|
:if ($Continue = false && $PathNext = "tmpfs") do={
|
||||||
:if ([ $MkTmpfs ] = false) do={
|
:if ([ $MkTmpfs ] = false) do={
|
||||||
|
:return false;
|
||||||
|
}
|
||||||
|
:set Continue true;
|
||||||
|
}
|
||||||
|
|
||||||
|
:if ($Continue = false && [ :len [ /file/find where name=$PathNext ] ] = 1) do={
|
||||||
|
$LogPrintExit2 warning $0 ("The path '" . $PathNext . "' exists, but is not a directory.") false;
|
||||||
:return false;
|
:return false;
|
||||||
}
|
}
|
||||||
:set Continue true;
|
|
||||||
}
|
|
||||||
|
|
||||||
:if ($Continue = false && [ :len [ /file/find where name=$PathNext ] ] = 1) do={
|
:if ($Continue = false) do={
|
||||||
$LogPrintExit2 warning $0 ("The path '" . $PathNext . "' exists, but is not a directory.") false;
|
:local Name ($PathNext . "-" . [ $GetRandom20CharAlNum 6 ]);
|
||||||
:return false;
|
:do {
|
||||||
}
|
/ip/smb/share/add disabled=yes directory=$PathNext name=$Name;
|
||||||
|
$WaitForFile $PathNext;
|
||||||
:if ($Continue = false) do={
|
} on-error={
|
||||||
:local Name ($PathNext . "-" . [ $GetRandom20CharAlNum 6 ]);
|
$LogPrintExit2 warning $0 ("Making directory '" . $PathNext . "' failed!") false;
|
||||||
:do {
|
:set Error true;
|
||||||
/ip/smb/share/add disabled=yes directory=$PathNext name=$Name;
|
}
|
||||||
$WaitForFile $PathNext;
|
/ip/smb/share/remove [ find where name=$Name ];
|
||||||
} on-error={
|
:if ($Error = true) do={
|
||||||
$LogPrintExit2 warning $0 ("Making directory '" . $PathNext . "' failed!") false;
|
:return false;
|
||||||
:set Error true;
|
}
|
||||||
}
|
|
||||||
/ip/smb/share/remove [ find where name=$Name ];
|
|
||||||
:if ($Error = true) do={
|
|
||||||
:return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user