Task

Get and set the modification time of a file.




files #f, DefaultDir$ + "\*.*"                  ' all files in the default directory
 
print "hasanswer: ";#f HASANSWER()              ' does it exist
print "rowcount: ";#f ROWCOUNT()                ' number of files in the directory
print                                           '  
#f DATEFORMAT("mm/dd/yy")                       ' set format of file date to template given
#f TIMEFORMAT("hh:mm:ss")                       ' set format of file time to template given
 
for i = 1 to #f rowcount()                      ' loop through the files
if #f hasanswer() then                          '  or loop with while #f hasanswer()
 print "nextfile info: ";#f nextfile$("    ")   ' set the delimiter for nextfile info
 print "name: ";name$                           ' file name                        
 print "size: ";#f SIZE()                       ' file size
 print "date: ";#f DATE$()                      ' file date
 print "time: ";#f TIME$()                      ' file time
 print "isdir: ";#f ISDIR()                     ' is it a directory or file
 
 name$ = #f NAME$()
 shell$("touch -t 201002032359.59 ";name$;""")  ' shell to os to set date
 
 print
end if
next