cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2412
Views
5
Helpful
8
Replies

Copying files between routers

blakem
Level 1
Level 1

Hi,

I'm trying to copy files between routers (by enabling FTP server), and to FTP server on my LAN. I would like to schedule the copying using kron, and copy files in bulk (e.g. mput or cp *).

The IOS command I was hoping would work is 'copy flash:/test/* ftp:......' but this doesn't work - are there any easy ways of doing this?

Many thanks,

Michael

2 Accepted Solutions

Accepted Solutions

See my reply to your other post regarding TCL. However, if your goal is to use a TCL script with kron, you need to be aware that kron and TCL did not work together prior to 12.4(3). Additionally, it is better to use the Embedded Event Manager if you want to schedule TCL code to run periodically. See http://www.cisco.com/en/US/products/ps6441/products_configuration_guide_chapter09186a0080559cd5.html for more on TCL scripting in EEM (note: this is NOT applicable to tclsh).

Here is a simple example for listing directory contents. You can use this to cycle over all files, and copy them as you see fit:

set fileList [glob -directory flash: -nocomplain *]

foreach file $fileList {

puts "Filename is $file"

}

View solution in original post

Yes, you should definitely buy a TCL referecne book. IOS implements just about all of TCL 8.3.4. I have already pointed out the table that contains the exceptions. To that, add that IOS TCL does not yet support pipelining or reading character-by-character from stdin.

View solution in original post

8 Replies 8

network.king
Level 4
Level 4

Hi

If you are copying files between routers , then make one of the router as tftp server and then do a copy.

Let me know if ur requirement was diff

regards

vanesh k

Hi,

I'd like to copy multiple files at once, e.g. copy * to another location, and then once that's done, setup a kron job to do the copy on a regular basis..

I've been reading about using TCL, but I can't find any simple examples..

Regards,

Michael

See my reply to your other post regarding TCL. However, if your goal is to use a TCL script with kron, you need to be aware that kron and TCL did not work together prior to 12.4(3). Additionally, it is better to use the Embedded Event Manager if you want to schedule TCL code to run periodically. See http://www.cisco.com/en/US/products/ps6441/products_configuration_guide_chapter09186a0080559cd5.html for more on TCL scripting in EEM (note: this is NOT applicable to tclsh).

Here is a simple example for listing directory contents. You can use this to cycle over all files, and copy them as you see fit:

set fileList [glob -directory flash: -nocomplain *]

foreach file $fileList {

puts "Filename is $file"

}

Thanks, that's exactly what I was wanting to do. I've had a look at EEM, and will give it a try at some point, but I'll just test with kron for now.

My goal is to replicate certificates granted by a CA router to a standby CA router (in case the primary one goes down).

Regards,

Michael

p.s. Can you please tell me if it would be worth buying a TCL/TK reference book - is a large subset of TCL implemented in the IOS?

Yes, you should definitely buy a TCL referecne book. IOS implements just about all of TCL 8.3.4. I have already pointed out the table that contains the exceptions. To that, add that IOS TCL does not yet support pipelining or reading character-by-character from stdin.

Thanks, that's excellent.

Regards,

Michael

By the way: you can find some EEM script examples here:

http://www.cisco.com/go/ciscobeyond

You can share yours, too!

Thanks,

Much appreciated.

Regards,

Michael

Review Cisco Networking for a $25 gift card