(view source code of fileattr.rex as plain text)
/* FileAttr, Version 2.01 *//* Cloned from the Norton Utilities for DOS *//* Display files with specified attributes, *//* and/or set the specified attributes *//* Written by Rob van der Woude *//* http://www.robvanderwoude.com *//* Initialize RexxUtil */If RxFuncQuery( "sysloadfuncs" ) <> 0 Then Do
Call RxFuncAdd "sysloadfuncs", "RexxUtil", "sysloadfuncs"
Call sysloadfuncsEnd/* Command line parsing */Parse Upper Arg files parameters
If files = "/?" Then Call Syntax
If files = "" Then files = "*"
Alist = "*"
Hlist = "*"
Rlist = "*"
Slist = "*"
Aset = "*"
Hset = "*"
Rset = "*"
Sset = "*"
If Pos( "+", parameters ) > 0 Then Do
If Pos( "A+", parameters ) > 0 Then Aset = "+"
If Pos( "H+", parameters ) > 0 Then Hset = "+"
If Pos( "R+", parameters ) > 0 Then Rset = "+"
If Pos( "S+", parameters ) > 0 Then Sset = "+"
If Pos( "+A", parameters ) > 0 Then Alist = "+"
If Pos( "+H", parameters ) > 0 Then Hlist = "+"
If Pos( "+R", parameters ) > 0 Then Rlist = "+"
If Pos( "+S", parameters ) > 0 Then Slist = "+"
EndIf Pos( "-", parameters ) > 0 Then Do
If Pos( "A-", parameters ) > 0 Then Aset = "-"
If Pos( "H-", parameters ) > 0 Then Hset = "-"
If Pos( "R-", parameters ) > 0 Then Rset = "-"
If Pos( "S-", parameters ) > 0 Then Sset = "-"
If Pos( "-A", parameters ) > 0 Then Alist = "-"
If Pos( "-H", parameters ) > 0 Then Hlist = "-"
If Pos( "-R", parameters ) > 0 Then Rlist = "-"
If Pos( "-S", parameters ) > 0 Then Slist = "-"
EndIf Pos( "*", parameters ) > 0 Then Do
If Pos( "A*", parameters ) > 0 Then Aset = "*"
If Pos( "H*", parameters ) > 0 Then Hset = "*"
If Pos( "R*", parameters ) > 0 Then Rset = "*"
If Pos( "S*", parameters ) > 0 Then Sset = "*"
If Pos( "*A", parameters ) > 0 Then Alist = "*"
If Pos( "*H", parameters ) > 0 Then Hlist = "*"
If Pos( "*R", parameters ) > 0 Then Rlist = "*"
If Pos( "*S", parameters ) > 0 Then Slist = "*"
Endoptions = "F"
If Pos( "/S", parameters ) > 0 Then options = options||"S"
listattr = Alist||"*"||Hlist||Rlist||Slist
setattr = Aset||"*"||Hset||Rset||Sset
Call SysFileTree files, "file.", options, listattr, setattr
If file.0 > 0 Then Do i = 1 to file.0
Say SubStr( file.i, 30 )
End/* End main program */Exit 0
Syntax:
SaySay "FileAttr, Version 2.01"
Say "Inspired by the Norton Utilities for DOS."
Say "Display and/or change file attributes of specified files."
SaySay "Usage: FILEATTR.REX filespec [ options ]"
SaySay 'Options: format is "dAs":'
Say " d (display) is either *, - or +"
Say " A (attribute) can be A, H, R or S"
Say " s (set) is either *, - or +"
Say " /S include subdirectories"
SaySay "Examples: *R+ make all files Read-only (set R attribute)."
Say " -H+ show files that are not hidden and make them hidden."
Say " -A* *S+ set S (system) attribute of all files that have their A"
Say " (archive) attribute not set."
SaySay "Note: In Windows, RegUtil's SysFileTree does not (yet) set file attributes,"
Say ' hence the "set" option ("s" in "dAs") is ignored in Windows.'
SaySay "Written by Rob van der Woude"
Say "http://www.robvanderwoude.com"
Exit 255
Returnpage last modified: 2025-10-11; loaded in 0.0142 seconds