in reply to comparing file times
Depends on if you want modified time, access time or inode change time.
For modified time which is likely the most common.
if( -M "file.pdl" < -M "file.cxx" ) { print "file.pdl is newer\n"; }
Likewise with -A for access time and -C for inode change time ( which used to be create time hence the C )
These filetests list the files age in days since the start of your perl script execution. This is usually positive for a briefly running script if your dates on the filesystem reflect reality and your clock is correct. Thus by comparing 2 numeric quantities you can make these descisions.
update: mea culpa, changed the text 'negative' to bolded 'positive'. Think days ago.
|
|---|