![[Toc]](../../toc.gif)
![[Index]](/idx.gif)
Changing file attributes
Changing the file creation time stamp
To change the file creation time stamp you must delete and recreate the
file:
testFile = 'C:\TEMP\TEST'
/* read the file */
fileContents = CharIn( testFile,1 , chars( testFile ) )
/* close the file */
call stream testFile, 'c', 'CLOSE'
/* delete the file */
'del ' testFile '2>NUL 1>NUL'
/* recreate the file */
call CharOut testFile, fileContents
/* close the file */
call stream testFile, 'c', 'CLOSE'
This code will set the creation time stamp to the current time and date.
If you need other values for this time stamp, you must change the current
date and time before executing the code and restore it afterwards. Note
that a time change is always global for the whole system!
You cannot read the creation time stamp with plain REXX. You need an
external REXX DLL, like for example REXXLIB from Quercus Systems (see
Internet - Web Pages), for this task.
Changing the last read time stamp
You can change the last read time stamp by opening the file for reading:
/* set the last read time stamp to the current */
/* date/time */
testFile = 'C:\TEMP\TEST'
call stream testFile, 'c', 'OPEN READ'
call stream testFile, 'c', 'CLOSE'
Note that you cannot read the last read time stamp with plain REXX. You
need an external REXX DLL, like for example REXXLIB from Quercus Systems
(see Internet - Web Pages), for this task.
Changing the last write time stamp
To change the last write time stamp you can use the "poor mans" touch:
testFile = 'C:\TEMP\TEST'
'copy ' || testFile || '+,,' '2>NUL 1>NUL'
Note that the date and time retrieved with <stream or with <SysFileTree is
always the last write time stamp.
Changing the file attributes
To change one or more of the file attributes you can either use the OS/2
command <ATTRIB or the REXXUTIL function <SysFileTree:
/* set the system and readonly attribute for the file C:\TEST */
/* - using ATTRIB */
'attrib' '+r +s' 'C:\TEST'
/* - using SysFileTree */
call RxFuncAdd 'SysFileTree', 'REXXUTIL', 'SysFileTree'
call SysFileTree 'C:\TEST', dummyStem, 'F', '*****', '***++'
Changing the extended attributes of a file
To read and write the extended attributes of a file you can use the
REXXUTIL functions <SysGetEA and <SysPutEA (and <SysQueryEAList in
Object-Oriented REXX).
To delete all extended attributes you can use the OS/2 command <EAUTIL:
'eautil c:\test nul /s'
(see also Extended Attributes used by the WPS, Extended Attribute Data
Types, Extract the icon from the EAs, and The function SysPutEA())
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs