in reply to Re^2: check for latest file, remove and touch file?
in thread check for latest file, remove and touch file?
At least in my environment (AIX), opening the file in append mode without adding any content does not update the modification date of the file.
$: date Thu Jan 7 09:37:01 CST 2016 $: touch step.file $: ls -l step.file -rw-r--r-- 1 wlsedi wlsedi 0 Jan 07 09:37 step.file $: date Thu Jan 7 09:38:01 CST 2016 $: touch step.file $: ls -l step.file -rw-r--r-- 1 wlsedi wlsedi 0 Jan 07 09:38 step.file $: date Thu Jan 7 09:39:38 CST 2016 $: perl -de 1 Loading DB routines from perl5db.pl version 1.28 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 1 DB<1> open $fh,'>>','step.file' DB<2> close $fh DB<3> q $: ls -l step.file -rw-r--r-- 1 wlsedi wlsedi 0 Jan 07 09:38 step.file
Opening in write does have the un-touchlike side effect of wiping out any content. In this particular instance, that is of no consequence, but using the code as a generic replacement for touch is problematic.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: check for latest file, remove and touch file?
by mr_mischief (Monsignor) on Jan 12, 2016 at 20:46 UTC |