2017-10-30

List tm file

#!/usr/bin/tclsh
package require fileutil

set tmpaths [::tcl::tm::path list]
foreach tmpath $tmpaths {
    if {[file exists $tmpath] && [file isdirectory $tmpath]} {
        foreach file [fileutil::find $tmpath {string match -nocase *.tm}] {
            puts $file
        }
    }
}

這只是練習用的程式。使用 tcllib fileutil,利用 fileutil::find 尋找副檔名為 tm 的檔案。雖然我有寫第一行,不過目前只有在 Windows 7 測試過。

沒有留言: