The Content Navigator, i.e. the web interface of CMS Fiona features a search form for comfortably finding a particular file. If you only need to locate files via Tcl, and searching their names for the occurrence of a string is sufficient, a small Tcl script will do.
All the script needs to do is determine the names of all files in a partial hierarchy, compare the names with the search string, and output the paths of the files found:
proc locate {objId searchString} { puts "Getting Ids..." set counter 0 set objects [listSubtree [findObjectId $objId]] foreach obj $objects { set name [obj withId $obj get name] if {[string match *$searchString* $name] == 1} { puts "[obj withId $obj get path]" incr counter } } puts "\n$counter files found" }
Save this procedure in a script file, for example in locate.tcl
. Then start the Tcl client of the Content Manager and make the locate
procedure contained in the script file available using source locate.tcl
. You can now run the procedure:
CM>locate /internet/news business