Hello.
I wrote a function to sort a list:
but if the filename contains a space, then error:
could not read "{F:/Tcl_project/images/DESERT SPIRIT150X300_PRE.JPG}": no such file or directory
while executing
"file mtime "$f2""
(procedure "sortl" line 7)
invoked from within
"sortl BBWG0902_PRE.JPG {DESERT SPIRIT150X300_PRE.JPG}"
(-compare command)
invoked from within
"lsort -command sortl $img"
invoked from within
"set im [lsort -command sortl $img]"
(file "iim.tcl" line 79)
help me please
I wrote a function to sort a list:
Code:
proc sortl {first second} {
set f1 [glob -nocomplain -directory "F:/Tcl_project/images" $first]
puts f1=$f1
set t1 [clock format [file mtime "$f1"] -format %H%M%S]
set f2 [glob -nocomplain -directory "F:/Tcl_project/images" $second]
set t2 [clock format [file mtime "$f2"] -format %H%M%S]
#puts $f2
set res [string compare "$t1" "$t2"]
if {$res != 0} {
return $res
} else {
return [string compare $t1 $t2]
}
}
could not read "{F:/Tcl_project/images/DESERT SPIRIT150X300_PRE.JPG}": no such file or directory
while executing
"file mtime "$f2""
(procedure "sortl" line 7)
invoked from within
"sortl BBWG0902_PRE.JPG {DESERT SPIRIT150X300_PRE.JPG}"
(-compare command)
invoked from within
"lsort -command sortl $img"
invoked from within
"set im [lsort -command sortl $img]"
(file "iim.tcl" line 79)
help me please