home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
subject.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-04-10
|
3KB
|
109 lines
/*******************************************************************
Displays or sets the subject (comment) of one or more files or
folders
Place this file as Subject.cmd somewhere in your path.
Examples:
Set subject on one file:
Subject shoplist.txt This is my shopping list
Display the subject on all files in current directory
Subject *
Display the subject on all files in current directory and below
Subject * /S
Delete the subject of a file:
Subject myfile.txt /D
Delete the subject of all files in current folder and below
Subject * /DS
Deletion means actually only truncating the subject field to zero i.e. the
extended attribute '.SUBJECT' still exists, but contains no data. 13 bytes
of extended attributes will remain allocated. If you want to remove these
bytes, you must at first set a subject and then delete it manually through the
settings menu item.
Jorgen Thomsen, Feb. 22, 1996
71310.2206@compuserve.com
(with improvements by Rob Goodman)
*******************************************************************/
Parse Arg fil opt Subject
opti = translate(opt)
options = ''
if opti = "/S" | opti = "/DS" then options = "S"
else
Subject = opt||' '||Subject
if left(opti,2) = '/D' then
do
opti = '/D'
Subject = ''
end
if fil = "" then
do
say " Displays or sets the subject (comment) of one or more files or"
say " folders"
say ""
say " Place this file as Subject.cmd somewhere in your path."
say ""
say " Examples:"
say " Set subject on one file:"
say " Subject shoplist.txt This is my shopping list"
say ""
say " Display the subject on all files in current directory"
say " Subject *"
say ""
say " Display the subject on all files in current directory and below"
say " Subject * /S"
say ""
say " Delete the subject of a file:"
say " Subject myfile.txt /D"
say ""
say " Delete the subject of all files in current folder and below"
say " Subject * /DS"
say ""
say " Deletion means actually only truncating the subject field to zero i.e. the"
say " extended attribute '.SUBJECT' still exists, but contains no data. 13 bytes"
say " of extended attributes will remain allocated. If you want to remove these"
say " bytes, you must at first set a subject and then delete it manually through the"
say " settings menu item."
say ""
exit
end
if RxFuncQuery('SysLoadFuncs') THEN
do
/*-- load the load-function --*/
CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
/*-- load the Sys* utilities --*/
CALL SysLoadFuncs
end
rc = SysFileTree(fil, res, options||"OB")
do i=1 to res.0
fil = res.i
If (Subject <> '') | (opti = '/D') then do
if opti = '/D' then do
SUBJECTINFO = ''
rc = SysGetEA(fil, ".SUBJECT", "SUBJECTINFO")
parse var SUBJECTINFO 5 Subj
if (SUBJECTINFO = '') | (Subj = '') then iterate i
say res.i||': subject deleted'
end
result = SysPutEA(fil, ".SUBJECT", 'FDFF'x||d2c(Length(subject))||'00'x||Subject)
end
if SysGetEA(fil, ".SUBJECT", "SUBJECTINFO") = 0 then do
parse var SUBJECTINFO 5 Subj
If Subj <> '' then do
say fil ":" Subj
end
end
end