Hi I am writing a tcl script to automate the task in linux. In that I want to copy files.
The command is
cp -r source destination
. I have tried using
puts [cp -rf source destination]
. But I am getting error saying invalid command cp. How will I write it in tcl script.
1
votes
1 Answers
4
votes
To run an external program from your script, you should use the exec
command:
puts [exec cp -r $source $destination]
However, for the specific case of copying a directory from one place to another you can use the built-in file copy
command (which works with directories as well as files):
file copy $source $destination