12-04-2006 04:10 AM
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
Solved! Go to Solution.
12-04-2006 09:08 AM
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"
}
12-05-2006 09:34 AM
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.