Like I said, file copy (or just copy, after my commit) will in fact copy directories.
In general, if you want to be recursive, we actually have a find command in pextlib, though the only place I know of it being used is in my fusefs port. That can be used such as
find basedir {filter_expression} {do stuff with $filename}
or
find -depth basedir {filter_expression} {do stuff with $filename, depth-first}
If you want to match everything, filter_expression should just be expr 1.
To give an example from fusefs, to recursively change file attributes (equivalent to chmod -R) I used
find ${sysfsdir}/fusefs.fs {expr 1} {
file attributes $filename -owner root -group wheel
}
That said, as long as I'm the only user of find (as I believe is the case) I am tempted to make some changes to the API. For example, the filter really should be an expr expression by default (as is the case with if/while/etc.), and the $filename variable really should have its name specified in the call, so it doesn't override an existing $filename (i.e. find basedir {filter} filevarname {some expression with $filevarname} ).
On Feb 14, 2007, at 12:28 AM, Mark Duling wrote:
If I'm not supposed to do 'system "cp -R ${dir} ${dir}"', then what is the
easiest and/or recommended way to accomplish the same thing without using
system calls?
3a) If the answer is no but a generic TCL script can be wrapped around
xinstall using globs, then an example be given for doing this. If neither
3 or 3a is possible, state that system calls for recursive copies are
acceptible.
Clarify 3 and I may be able to answer this as well.
If there isn't a way to do recursive copies (functionally equivalent to cp
-R) without system calls, is there a generic foolproof way to accomplish
gneric recursive copies in TCL extensions by wrapping them in a script as
in your example with reinplace?