Hi!
I am trying to use Exec to get a list of files with ls, here is the code:
for {set i 0} {$i < $nbdir} {incr i} {
# puts $swdirlist($i)
#test if directory exists
if { [file isdirectory "$swdirlist($i)/$swprjsel"] } {
set cmd "$swdirlist($i)/$swprjsel/*.\[3bc\]\[drm\]\[viph\]"
set execCmd "exec ls -l $cmd"
catch { eval $execCmd } result
puts $result
# lappend seisfile $result
}
}
I get an error invalid command name "3bc". I have added \before the ['s same result
An add_on question is that I want to store the result in a string so I put lappend seisfile $result is it the best thing to do. Later on on I want to extract some specific filenames from this string.
Many thanks!
I am trying to use Exec to get a list of files with ls, here is the code:
for {set i 0} {$i < $nbdir} {incr i} {
# puts $swdirlist($i)
#test if directory exists
if { [file isdirectory "$swdirlist($i)/$swprjsel"] } {
set cmd "$swdirlist($i)/$swprjsel/*.\[3bc\]\[drm\]\[viph\]"
set execCmd "exec ls -l $cmd"
catch { eval $execCmd } result
puts $result
# lappend seisfile $result
}
}
I get an error invalid command name "3bc". I have added \before the ['s same result
An add_on question is that I want to store the result in a string so I put lappend seisfile $result is it the best thing to do. Later on on I want to extract some specific filenames from this string.
Many thanks!