Posted By

Phoenicia7 on 05/14/12


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

joseamirandavelez


Recurse Folders


 / Published in: TCL
 

  1. proc _recurseFolders {folder} {
  2. # This script will build a list of files in the pwd including files in subfolders.
  3.  
  4. # Append all the files to a list of files.
  5. foreach i [glob -nocomplain -types f -directory $folder -- *] {
  6. lappend list_of_files $i
  7. }
  8.  
  9. # Foreach directory recurse this procedure.
  10. foreach j [glob -nocomplain -types d -directory $folder -- *] {
  11. set list_of_files [concat $list_of_files [_recurse_folders $j]]
  12. }
  13.  
  14. # Return the list of all the files.
  15. return $list_of_files
  16. }
  17.  

Report this snippet  

You need to login to post a comment.