Community discussions

MikroTik App
 
hotspotsolutions
Member Candidate
Member Candidate
Topic Author
Posts: 119
Joined: Thu Dec 16, 2004 1:48 pm

IS there a way to move a File? in 3.1

Thu May 29, 2008 2:35 am

Hi,

I want to move a file using the /file commands, however I cant see any way to do this.

can anyone help?
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24493
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: IS there a way to move a File? in 3.1

Thu May 29, 2008 9:22 am

move a file where? no, probably not possible.
No answer to your question? How to write posts
 
hotspotsolutions
Member Candidate
Member Candidate
Topic Author
Posts: 119
Joined: Thu Dec 16, 2004 1:48 pm

Re: IS there a way to move a File? in 3.1

Thu May 29, 2008 9:52 am

Hi,

sorry to another folder.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24493
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: IS there a way to move a File? in 3.1

Thu May 29, 2008 9:54 am

you can do that only with winbox drag-and-drop
No answer to your question? How to write posts
 
hotspotsolutions
Member Candidate
Member Candidate
Topic Author
Posts: 119
Joined: Thu Dec 16, 2004 1:48 pm

Re: IS there a way to move a File? in 3.1

Thu May 29, 2008 10:25 am

disapointing.

would be good to have in scripting!
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24493
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: IS there a way to move a File? in 3.1

Thu May 29, 2008 10:36 am

please give an example when this would be useful?
No answer to your question? How to write posts
 
hotspotsolutions
Member Candidate
Member Candidate
Topic Author
Posts: 119
Joined: Thu Dec 16, 2004 1:48 pm

Re: IS there a way to move a File? in 3.1

Thu May 29, 2008 10:40 am

Hi,

we are writing an automation system where we want to update the hotspot files with new ones, so we fetch them, then we would want to move them to a new folder.

I know we can do this via FTP the other way around, however I would prefer to do it via scripting.

Also would be good to be able to name the result of the "/tool fetch", we are sending alot of data, (or trying too) but the special characters are naming the files wrong and breaking it.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24493
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: IS there a way to move a File? in 3.1

Thu May 29, 2008 10:41 am

ok, fair enough. I will see if it's possible to make it
No answer to your question? How to write posts
 
hotspotsolutions
Member Candidate
Member Candidate
Topic Author
Posts: 119
Joined: Thu Dec 16, 2004 1:48 pm

Re: IS there a way to move a File? in 3.1

Thu May 29, 2008 10:49 am

great, that would really be appreciated.

We have about 950 mikrotik boards in the field at the moment, would be nice to have a script that can do everything automatically, will allow me to get a holiday at the end of the year :)
 
User avatar
rgraham
Frequent Visitor
Frequent Visitor
Posts: 59
Joined: Thu May 05, 2005 10:50 pm
Location: USA Minneapolis, Minnesota

Re: IS there a way to move a File? in 3.1

Fri May 30, 2008 11:04 pm

Hey, can I put in my two cents worth.

I could also use file move, copy, delete, and rename commands and have them work across disk drives so you can move from flash to disk or disk to disk.

It would be real nice to be able to ftp with all the capabilities of ftp seen in Linux. Should be easy being MT router is embeded Linux. This could be used to put or get configurations, scripts, packet captures and OS upgrades, just to name a few. Image the power.
Randy
 
User avatar
omega-00
Forum Guru
Forum Guru
Posts: 1167
Joined: Sat Jun 06, 2009 4:54 am
Location: Australia
Contact:

Re: IS there a way to move a File? in 3.1

Sat May 31, 2008 5:33 pm

hotspotsolutions: why not make the initial login page a redirect page to a remote http server.. then you can host all content on there are redirect user to specific content based on the IP they are coming from, no need to login to each device to change.
 
buzz57
just joined
Posts: 10
Joined: Sun May 18, 2008 9:29 pm

Re: IS there a way to move a File? in 3.1

Thu Jun 19, 2008 2:47 pm

If you could specify a root path destination with the fetch tool that would be really useful. We are having a similar problem and have several scripts used to send information to a destination on the web. Also the ability to copy/move files around on the Routerboard OS platform would be really useful. 8)
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: IS there a way to move a File? in 3.1

Fri Jun 27, 2008 4:52 pm

It is possible to get a root shell on Mikrotik, and with a Busybox binary compiled with wget you can easily give the target path that you want your 'fetched' file to be saved, so it goes into the right place.

e.g. wget -O /var/pckg/hotspot/login.html http://11.22.33.44/login.html

Automating it requres that you have a busybox binary compiled with crond too, or you could write your own script to sleep for ages, do the wget, back to sleep etc.

Getting it to work requires physical access to the routerboard, and a fair amount of messing about though.

I just wish that the 'fetch' command had that same feature of wget.
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: IS there a way to move a File? in 3.1

Fri Jun 27, 2008 8:07 pm

OR,

you could just use a script to 'fetch' what you want, and then use mv to put it where you want it ....
Don't forget to give me at least a tenner a month, every month
 
RUok0101
just joined
Posts: 2
Joined: Sat Aug 25, 2007 8:00 am

Re: IS there a way to move a File? in 3.1

Thu Jul 03, 2008 5:03 am

Moving a file would be extremely helpful as well. I can't believe more people don't bring it up, but when using /tool fetch to grab a dynamic cgi script contents, its a pain in the butt.

For example:

/tool fetch address=secure.myserver.com path="cgi-bin/update.cgi\?hw=00:11:22:33:44:55&fw=3.10&hn=acct2svc2&mode=ap" host=secure.myserver.com

The file becomes:

/file print

0 sysupdate.cgi?node=00:11:22:33:44:55&fw=3.10&hn=acct2svc2&mode=ap .10&hn=acct2svc2&mode=ap file 1405 jul/03/2008 01:52:32


a simple "outfile" parameter to 'fetch' would be grand.
 
nielsbos
just joined
Posts: 10
Joined: Thu Dec 15, 2011 9:45 pm

Re: IS there a way to move a File? in 3.1

Thu Dec 15, 2011 11:22 pm

I resolved all file problems with a copy. We can already remove files, and with an additional copy option, we can:
* copy
* move (=copy+remove)
* rename (=move)
* remove

Here's the code:
# Machine setup (one-time run)
# - Add a loopback interface (bridge with no interfaces linked to it)
/interface bridge
add admin-mac=00:00:00:00:00:00 ageing-time=5m arp=enabled auto-mac=yes \
    comment="We use this loopback for the router to access itself. No interfac\
    es should be assigned to it!" disabled=no forward-delay=15s l2mtu=65535 \
    max-message-age=20s mtu=1500 name=loopback priority=0x8000 protocol-mode=\
    none transmit-hold-count=6
/interface bridge settings
set use-ip-firewall=no use-ip-firewall-for-pppoe=no use-ip-firewall-for-vlan=\
    no
# - Add a IP with subnet 255.255.255.255 (single-ip network)
/ip address add address=10.0.0.1/32 comment="Loopback for file copying" disabled=no \
    interface=loopback network=10.0.0.1
# - Add global variables with the ftp user and password
:global ftpuid "self"
:global ftppwd "fdalsu90f3aopJIoIokidf0SI9"
# - Add a full-access user to do the copying (only allow address of router itself)
/user add address=127.0.0.1/32,10.0.0.1/32 comment="Loopback user" disabled=no \
    group=full name=$ftpuid password=$ftppwd
# - Enable the ftp service (todo: use firewall filter to secure)
/ip service set ftp disabled=no port=21

########################################################

# Actual copying/moving script
/tool fetch mode="ftp" address="10.0.0.1" src-path="oldfilename.txt" dst-path="newfilename.txt" user=$ftpuid password=$ftppwd
# Optional: Remove the file, if you are moving or renaming
As you can see, I use a loopback interface with the IP 10.0.0.1. This allows you to block FTP on all other interfaces but still allow copying within the router.

If you have any questions, feedback or improvement, please let me know at my niels.bos@live.com e-mail address.

Cheers,
Niels

Who is online

Users browsing this forum: eworm and 18 guests