Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Copying files between routers

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
Cisco Employee

Re: Copying files between routers

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"

}

Cisco Employee

Re: Copying files between routers

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.

8 REPLIES

Re: Copying files between routers

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

New Member

Re: Copying files between routers

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

Cisco Employee

Re: Copying files between routers

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"

}

New Member

Re: Copying files between routers

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?

Cisco Employee

Re: Copying files between routers

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.

New Member

Re: Copying files between routers

Thanks, that's excellent.

Regards,

Michael

New Member

Re: Copying files between routers

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

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

You can share yours, too!

New Member

Re: Copying files between routers

Thanks,

Much appreciated.

Regards,

Michael

396
Views
5
Helpful
8
Replies
CreatePlease login to create content