>August Karlstrom wrote: >> What is the standard way in TCL to get a list of all files in a >> directory and its subdirectories?

>package require fileutil >fileutil::find

>(Requires Tcllib installed.)

. . . Keep in mind a couple of factors that reduce the scariness common with "requires X installed": A. ActiveTcl, now widely used, provides Tcllib; and B. the current copy of fileutil.tcl is under 700 lines of pure-Tcl, and that includes a lot of comments, so it's not hard to just pull in a copy of *that* alone, if you prefer (note, though, that fileutil itself requires cmdline).

Bill Poser wrote: > fileutil::find is useful but it is an extension, not a "standard", and > does more than the OP needs. The glob command, which is part of the > core, is the standard way to list all files in a directory.

The original poster asked for "all files in a directory and its subdirectories"; so fileutil::find is absolutely the right thing.

Donal.

On Jun 3, 7:50 pm, August Karlstrom <fusionf@comhem.se> wrote:

> Hi everyone,

> What is the standard way in TCL to get a list of all files in a > directory and its subdirectories?

> Regards,

> August

I like for_recursive_glob from Tclx (there is also just recursive_glob).

On Jun 4, 1:23 am, "Donal K. Fellows" <donal.k.fell@man.ac.uk> wrote:

> Bill Poser wrote: > > fileutil::find is useful but it is an extension, not a "standard", and > > does more than the OP needs. The glob command, which is part of the > > core, is the standard way to list all files in a directory.

> The original poster asked for "all files in a directory and its > subdirectories"; so fileutil::find is absolutely the right thing.

> Donal.

Ah, that depends on whether the OP's request contains an implicit "recursively". If it does, yes, fileutil::find is right. If it doesn't, glob * */* does the job.

billpo@alum.mit.edu wrote: > On Jun 4, 1:23 am, "Donal K. Fellows" <donal.k.fell@man.ac.uk> > wrote: >> Bill Poser wrote: >>> fileutil::find is useful but it is an extension, not a "standard", and >>> does more than the OP needs. The glob command, which is part of the >>> core, is the standard way to list all files in a directory. >> The original poster asked for "all files in a directory and its >> subdirectories"; so fileutil::find is absolutely the right thing.

>> Donal.

> Ah, that depends on whether the OP's request contains an implicit > "recursively". > If it does, yes, fileutil::find is right. If it doesn't, glob * */* > does the job.

You are right, after rereading my posting I realise I should have added the word "recursively".