/* 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 sysloadfuncs End /* 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 = "+" End 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 = "-" End 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 = "*" End options = "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: Say Say "FileAttr, Version 2.01" Say "Inspired by the Norton Utilities for DOS." Say "Display and/or change file attributes of specified files." Say Say "Usage: FILEATTR.REX filespec [ options ]" Say Say '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" Say Say "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." Say Say "Note: In Windows, RegUtil's SysFileTree does not (yet) set file attributes," Say ' hence the "set" option ("s" in "dAs") is ignored in Windows.' Say Say "Written by Rob van der Woude" Say "http://www.robvanderwoude.com" Exit 255 Return