cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Unable to write/create a file through TCL command

ahuamancayo
Beginner
Beginner

Hello Everyone!

 

I'm trying to create/write a file in bootflash: through a script and It fails... I tried to run the command directly in the TCLSH interpreter but I get this message:

 

N7K-CORE# tclsh
N7K-CORE-tcl# open bootflash:///clock.log "a+"
couldn't open "bootflash:///clock.log": no such file or directory
N7K-CORE-tcl# open bootflash://clock.log "a+"
couldn't open "bootflash://clock.log": no such file or directory
N7K-CORE-tcl# open bootflash:/clock.log "a+"
couldn't open "bootflash:/clock.log": no such file or directory

N7K-CORE-tcl# dir
4096 Apr 28 17:32:52 2021 Scripts/
0 Apr 28 17:30:22 2021 clock.log
0 Apr 28 17:29:44 2021 infoTAC.log
664 Sep 29 15:22:10 2014 vlan.dat

Usage for bootflash://
1281138688 bytes used
535347200 bytes free
1816485888 bytes total
N7K-CORE-tcl# exit

Any thoughts?

 

Thanks in advance.

Adrian

@TCL @nexus @nx-os

2 REPLIES 2

balaji.bandi
VIP Guru VIP Guru
VIP Guru

Can you able to read the file :  (it is 0 size ?)

 

show file  bootflash://clock.log

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Hi, yeah, it's empty beacause the original message was like "there's not such file", so I thought maybe it need the file to already exists so I created empty...

Now, I've just uploaded a new file with some content and yes I can read it:

 

N7K-CORE# show file bootflash:clock.log
Sample Text
working on it...
N7K-CORE# 

I tried the same tests and I aaded the last line, so I thought it works without slashes: 

 

 

N7K-CORE-tcl# open bootflash:///clock.log "a+"
couldn't open "bootflash:///clock.log": no such file or directory
N7K-CORE-tcl# open bootflash://clock.log "a+"
couldn't open "bootflash://clock.log": no such file or directory
N7K-CORE-tcl# open bootflash:/clock.log "a+"
couldn't open "bootflash:/clock.log": no such file or directory
N7K-CORE-tcl# open bootflash:clock.log "a+"
file37
N7K-CORE-tcl# 

I tried again writing in the file without the slashes but It's waiting for an integer... I tried the integer and it didn't write anything:

 

 

N7K-CORE-tcl# open bootflash:clock.log "a+" {
> "insert new line here"
> }
expected integer but got "
"insert new line here"
"
N7K-CORE-tcl# open bootflash:clock.log "a+" {
> 256
> }
file38
N7K-CORE-tcl# exit
N7K-CORE# show file bootflash:clock.log
Sample Text
working on it...
N7K-CORE1# 

 

Any other idea? Anyway, thanks for your time

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: