Create a file on a Cisco router

We will be using TCL to accomplish it.

  • Code
  • What it looks like
#File creation
tclsh
puts [open "flash:file.txt" w+] {
This is the contents of the file named file.txt that we are creating.
} 
tclquit

#Verifying that the file was created
dir | i file

#Listing of the file
more flash:file.txt
ro-b-pe02(tcl)#puts [open "flash:file.txt" w+] {
+>This is the contents of the file named file.txt that we are creating.
+>}
ro-b-pe02(tcl)#tclquit
ro-b-pe02#dir | i file
   14  -rw-               72  Aug 31 2023 14:05:28 +00:00  file.txt
ro-b-pe02#
ro-b-pe02#more flash:file.txt
This is the contents of the file named file.txt that we are creating.

ro-b-pe02#

Leave a Comment