File modification time: Difference between revisions
Content added Content deleted
m (Added the Sidef language) |
|||
Line 32: | Line 32: | ||
=={{header|AWK}}== |
=={{header|AWK}}== |
||
{{works with|gawk}} |
|||
AWK has no direct access to the filesystem, |
|||
<lang awk>@load "filefuncs" |
|||
but can execute system-commands like <code>dir</code> (DOS/Windows), |
|||
@load "readdir" |
|||
<code>ls</code>, <code>stat</code>, <code>touch</code> (Unix). |
|||
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 |
<lang awk>#!/bin/awk -f |