Code: Select all
bind pub - !tf findfile2
proc findfile2 {nick uhost hand chan text} {
set file1a "/home/BabyEcm/test/test1.txt"
set file1b "/home/BabyEcm/test/test2.txt"
set file2a "/home/BabyEcm/test/test3.txt"
set file2b "/home/BabyEcm/test/test4.txt"
# Open file for read access (note we're not catching errors, you might
# want to use catch {} if the file might not exist.
puthelp "PRIVMSG $chan :working on a tcl routine to detect files"
if {[file exists $file1a] == 1} {
set ynmsg "$file1a does exist"
set cfdateunix [file mtime $file1a]
set creationdate [strftime $cfdateunix %r]
} else {
set ynmsg "$file1a does NOT exist"
}
# Here we read in all of the data.
puthelp "PRIVMSG $chan :$ynmsg, $creationdate"
}
Code: Select all
<+BabyEcm> working on a tcl routine to detect files
<+BabyEcm> /home/BabyEcm/test/test1.txt does exist, 1183648942