File Format in TCL

Hi,

Can anyone please guide me in writing a TCL script. I want to have a procedure to recreate an existing file and backup its copy and rename it by time of the updates are made.

Eg:
I have file xyz.tcl (which on recreation is saved as xyz_11jan_15_30_11.tcl)

So when I do

% ls
xyz.tcl
xyz_11jan_15_30_11.tcl {last modified and saved time}

Thanks in advance

Try this

proc ls filename {
set file_newname [clock format [file mtime $filename] -format %d_%b_%Y_%H_%M_%S]
file copy -force $filename ${filename}_${file_newname}
}