home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rexxlb.zip
/
SAMPLES
/
FINDEA.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-02-04
|
2KB
|
75 lines
/*****************************************************************************/
/* */
/* FINDEA: traverse tree of directories, starting at specified directory, */
/* searching for all files that have extended attributes. */
/* */
/* Requires Personal REXX or REXXLIB (dosdrive, doscd, dosdir, dosdirpos, */
/* doseasize, upper, parsefn functions). */
/* */
/* Command format: FINDEA <directory> */
/* */
/*****************************************************************************/
parse arg directory
parse value parsedname(directory) with drive ',' path ',' fileid
if drive = '' then
drive = dosdrive()
if path = '' then do
path = doscd(drive)
end
if path \= '\' then
path = path'\'
if fileid = '' then
fileid = '*.*'
call listea drive':'path, fileid
exit
/* recursive procedure to find files in a directory with extended attrs */
listea: procedure
parse arg directory, fileid
name = dosdir(directory||fileid, 'n')
do while name \= ''
i = doseasize(directory||name);
if i > 0 then do
say directory||name 'has' i 'bytes of extended attributes.'
j = dosealist(directory||name, 'foo')
if j <= 0 then
say 'Error reading EAs'
else
say ' There are' j 'EAs'
end
name = dosdir(, 'n')
end
name = dosdir(directory'*.*','n','d','d')
do while name \= ''
position = dosdirpos()
if name \= '.' & name \= '..' then
call listea directory||name'\', fileid
name = dosdir(,'n','d','d',position)
end
return
/* parse a file identifier */
parsedname: procedure
x = upper(arg(1))
parsed = parsefn(x)
if parsed = '' then
parsed = '- - - -'
parse var parsed drive path fn ft
if drive = '-' then
drive = dosdrive()
if path = '-' then
path = doscd(drive)
if right(path,1) \= '\' then
path = path'\'
if fn = '-' then
fileid = '*.*'
else if ft = '-' then
fileid = fn
else
fileid = fn'.'ft
return drive','path','fileid