Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -6,6 +6,7 @@
|
|||
{{omit from|PARI/GP}}
|
||||
{{omit from|Retro}}
|
||||
{{omit from|TI-83 BASIC}} {{omit from|TI-89 BASIC}} <!-- Does not have a filesystem, just namespaced variables. -->
|
||||
{{omit from|Axe}}
|
||||
{{omit from|ZX Spectrum Basic|Does not have a real time clock.}}
|
||||
{{task|File System Operations}}
|
||||
This task will attempt to get and set the modification time of a file.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
PROC get output = (STRING cmd) VOID:
|
||||
IF STRING sh cmd = " " + cmd + " ; 2>&1";
|
||||
STRING output;
|
||||
execve output ("/bin/sh", ("sh", "-c", sh cmd), "", output) >= 0
|
||||
THEN print (output) FI;
|
||||
get output ("rm -rf WTC_1"); CO Ensure file doesn't exist CO
|
||||
get output ("touch WTC_1"); CO Create file CO
|
||||
get output ("ls -l --time-style=full-iso WTC_1"); CO Display its last modified time CO
|
||||
get output ("touch -t 200109111246.40 WTC_1"); CO Change its last modified time CO
|
||||
get output ("ls -l --time-style=full-iso WTC_1") CO Verify it changed CO
|
||||
15
Task/File-modification-time/AWK/file-modification-time-1.awk
Normal file
15
Task/File-modification-time/AWK/file-modification-time-1.awk
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
@load "filefuncs"
|
||||
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)
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fname = "fool.txt"
|
||||
tfmt = "%FT%T%z"
|
||||
|
||||
println("The modification time of ", fname, " is ")
|
||||
println(" ", strftime(tfmt, mtime(fname)))
|
||||
|
||||
println("\nTouch this file.")
|
||||
touch(fname)
|
||||
|
||||
println("The modification time of ", fname, " is now ")
|
||||
println(" ", strftime(tfmt, mtime(fname)))
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/*REXX program (Regina) to obtain/display a file's time of modification. */
|
||||
parse arg $ . /*get the fileID from the CL*/
|
||||
if $=='' then do; say "***error*** no filename was specified."; exit 13; end
|
||||
q=stream($, 'C', "QUERY TIMESTAMP") /*get file's mod time info. */
|
||||
if q=='' then q="specified file doesn't exist." /*give an error indication. */
|
||||
say 'For file: ' $ /*display the file ID. */
|
||||
say 'timestamp of last modification: ' q /*display modification time.*/
|
||||
/*stick a fork in it, we're all done. */
|
||||
Loading…
Add table
Add a link
Reference in a new issue