Community discussions

MikroTik App
 
midenok
newbie
Topic Author
Posts: 39
Joined: Fri Dec 27, 2013 5:34 pm

Command to create directory?

Fri Dec 04, 2015 2:15 pm

I just don't get it. Isn't there a straight way to create a directory except "shaman dance" that Google suggests?
RouterOS 6.34
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24799
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Command to create directory?

Fri Dec 04, 2015 2:15 pm

RouterOS does not have a proper file manager or directory support.
You can use SMB and then make folders from your Windows Explorer
No answer to your question? How to write posts
 
User avatar
stewartpe
just joined
Posts: 13
Joined: Wed Dec 12, 2007 7:49 pm

Re: Command to create directory?

Sat Jan 02, 2016 4:58 am

ftp into the router, then press ? for a list of commands.
mkdir will be most helpful.
 
jaadu
just joined
Posts: 12
Joined: Mon Sep 30, 2013 6:14 am

Re: Command to create directory?

Sun Jul 21, 2019 5:05 am

Create the folder you want on your desktop and drag it in to 'Files' via winbox.
 
User avatar
eworm
Forum Veteran
Forum Veteran
Posts: 751
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Command to create directory?

Tue Jul 23, 2019 11:09 pm

No idea why the script creates user, group and whatever. Given you have http-ssl service enabled this should suffice:
/tool fetch https://127.0.0.1/ dst-path=path/to/create/xxx
Alternatively use whatever webserver. It creates a file as well, just remove that:
/file remove path/to/create/xxx
Manage RouterOS scripts and extend your devices' functionality: RouterOS Scripts
 
Fantomas
just joined
Posts: 2
Joined: Wed Jan 13, 2021 12:36 pm

Re: Command to create directory?

Wed Jan 13, 2021 1:49 pm

No idea why the script creates user, group and whatever. Given you have http-ssl service enabled this should suffice:
/tool fetch https://127.0.0.1/ dst-path=path/to/create/xxx
Alternatively use whatever webserver. It creates a file as well, just remove that:
/file remove path/to/create/xxx

How about using 'dot' in place of 'xxx' like below. This way the website won't be saved as 'xxx' file even if is fetched (adding keep-result=no won't create any directories):
{
# ----- Create directory tree with /fetch -----
# Take note of the 'dot' (or 'space') in place of 'file name',
# this will prevent the fetched website from actually being saved as a file
# even if fetch is successful
:local path "disk1/complex/directory/tree/."
:do { /tool fetch dst-path=($path) url="https://127.0.0.1/"; } on-error={ :put "Script will continue dispite an error"; }
:local otherpath "disk1/some/other/dir/."
/tool fetch dst-path=($otherpath) url="https://www.google.com/"
}
 
User avatar
eworm
Forum Veteran
Forum Veteran
Posts: 751
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Command to create directory?

Wed Jan 20, 2021 3:14 pm

A file name containing just a dot represents the current directory. So you create the directory and try to overwrite it with a file... This results in an error:
  status: failed

failure: cannot open file
With your code you have to catch and ignore the error.
I prefer my clean solution. 😜
Manage RouterOS scripts and extend your devices' functionality: RouterOS Scripts

Who is online

Users browsing this forum: m94646602, ryszard and 20 guests