Setting file date and time attributes ------------------------------------- J.G.Harston, 12-Mar-1999 Some filing systems allow objects to have creation and modification dates and times. RISC OS recognises an object's modification date and time in the load and execution addresses. The following code sets an object's date and time in both the load/exec addresses and any seperate date/time fields. REM:>BLib.Date REM:>BLib.FileIO REM:>BLib.NetFS REM:DIM X% 127:Y%=X%DIV256 REM:DIM name% 127 : REM f$ - filename REM t% - RISC OS filetype or -1 to not change REM cd%, cm%, cy% - creation day, month, year REM chr%, cmn%, csc%, ccs% - creation hours, minutes, seconds, centiseconds REM md%, mm%, my% - modification day, month, year REM mhr%, mmn%, msc%, mcs% - modification hours, minutes, seconds, centiseconds : DEFPROCFile_Stamp(f$,t%,cd%,cm%,cy%,chr%,cmn%,csc%,ccs%,md%,mm%,my%,mhr%,mmn%,msc%,mcs%) A%=FNfile(f$,5):PROCDate_FromOrd(X%+6,md%,mm%,my%,mhr%,mmn%,msc%,mcs%) IFt%=-1:t%=X%!2 AND-256 ELSE t%=t%*256 OR &FFF00000 X%!2=X%?10 OR t%:X%!15=FNf_date(md%,mm%,my%):A%=FNfile(f$,1) X%!8=FNf_date(md%,mm%,my%):A%=FNNetFS_OpN(19,5,10,f$) X%!8=FNf_date(cd%,cm%,cy%):X%!10=FNf_time(chr%,cmn%,csc%) X%!13=FNf_date(md%,mm%,my%):X%!15=FNf_time(mhr%,mmn%,msc%) A%=FNNetFS_OpN(19,64,18,f$) ENDPROC : DEFFNf_date(d%,m%,y%):y%=y%-1981:=d%+m%*256+(y%AND15)*4096+(y%DIV16)*32 DEFFNf_time(h%,m%,s%):=h%+m%*256+s%*65536 The code requires a global control block name% long enough to hold the longest pathname used, and a global control block of at least 20 bytes more than the longest pathname used, accessible with X% holding the address of this block, and Y% holding X% DIV 256. This can easily be set up with, for example DIM ctrl% 127, name% 127 near the start of the program and X%=ctrl%:Y%=X%DIV256 at the begining of the major program code and at the start of any main program loop. The BASIC program libraries Date, FileIO and NetFS are required.