Simple Sand Samples |
Tcl > ファイルやディレクトリの存在を調べる
exists.tcl
if { [ file exists hoge.txt ] == 1 } then { puts "Found." } else { puts "Not Found." }
$ tclsh exists.tcl
Not Found.
$ touch hoge.txt
$ tclsh exists.tcl
Found.
$
Not Found.
$ touch hoge.txt
$ tclsh exists.tcl
Found.
$
* 確認環境 Debian Linux(Wheezy)