Anonymous user
File modification time: Difference between revisions
→{{header|AWK}}
m (Added the Sidef language) |
|||
Line 32:
=={{header|AWK}}==
{{works with|gawk}}
<lang awk>@load "filefuncs"
@load "readdir"
BEGIN {
name = "input.txt"
# display time
stat(name, fd)
printf("%s\t%s\n", name, strftime("%a %b %e %H:%M:%S %Z %Y", fd["mtime"]) )
# change time
cmd = "touch -t 201409082359.59 " name
system(cmd)
close(cmd)
}</lang>
Non-GNU awk's don't have direct access to the filesystem but can execute system-commands.
<lang awk>#!/bin/awk -f
|