๐Ÿ“œ
B.TECH III YEAR โ€ข II SEMESTER โ€ข R22

Scripting Languages - Lab Manual

Scripting Languages Laboratory โ€ข Program 15 Solution

๐Ÿ“˜ R22 Regulation ๐ŸŽ“ III Year ๐Ÿ“š II Semester ๐Ÿ“œ Scripting Languages ๐Ÿ’Ž Ruby โ€ข TCL โ€ข Perl ๐Ÿงช Lab Program
Aim of Program 15

Write a TCL script to comparing the file modified times.

โ† All Programs
Solution

Aim:

☛   Write a TCL script to comparing the file modified times.

Solution :

PROGRAM: (compare_files.tcl)

 
set file1 "file1.txt"
set file2 "file2.txt"

set t1 [file mtime $file1]
set t2 [file mtime $file2]

if {$t1 > $t2} {
    puts "$file1 is newer"
} elseif {$t1 < $t2} {
    puts "$file2 is newer"
} else {
    puts "Both files have same modified time"
}


OUTPUT:

 
file2.txt is newer



โ† Back to Scripting Languages Lab Programs ๐Ÿ“š All Lab Manuals