Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"exec" instead of "glob" to crate a list of file in windows

Status
Not open for further replies.

AnsBGA

Technical User
Oct 11, 2002
5
US
At the compile time I want to create a list of image files and can not use glob as the image files are also gets wraped in the execuatable.

This works on UNIX"
set imageList [list ‘echo images/*.gif‘]

What is the equivalent of this in Windows? How can I use exec dir [ file join ..... ] or some other clever way to do it.

Thanks,
Nick
 
set ok [dir c:/images/*.gif]

foreach n $ok {
puts [file tail $n]
}
Remember the stupid 8.3 rule.
ex:dir c:/progra~1/
Seems to work okay.
 
Thanks, Now the next question is how to convert a file name to short names for 8.3 stupid rule. I am not a windos user.

The dir name may have long names and spaces. e.g.
c:/fdsdafd sfds/asfdsf/*.gif

Is there a way in Tcl to convert this string to short names. eg. the middel line in the folling code.

set long_name dir [ file join ..........]
short_name [convert_to_shrot_name $long_name]
set ok [dir $short_name]

Thanks,
nick
 
Yep:
proc eightthree {nme} {
if {[string length $nme] > 6} {
set nme "[string range $nme 0 5]~1"
}
return $nme
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top