TIP: Click on subject to list as thread! ANSI
echo: os2user-l
to: All
from: Andy Willis
date: 2004-10-07 19:09:54
subject: Re: ATTRIB Does Not Work !!!

Kris Steenhaut wrote:

>
>Don{ald} O. Woodall schreef:
>
>  
>
>>Hello Command Line Experts
>>
>>    This is my second experience of this failure ina month
>>or so.  Thought I would speak up this time, seeing as I will
>>need to suffer through this twice.
>>
>>    My understanding is that the command:
>>
>>             attrib -r *.* /s
>>
>>is supposed to remove the Readonly protection from every file in the
>>directory it is executed and in every directory nested below the directory
>>of execution.
>>
>>            IT DOES NOT WORK !!!!
>>
>> 
>>
>>    
>>
I don't have time to trim out the extra stuff but here is a REXX script 
that can be modified to do what you want.  It is already in there but it 
is part of a whole that I use to remove directory trees.
/* Delete Directory tool */
/* Define Rexx Functions */
n = SETLOCAL()
p = VALUE('deldir','','OS2ENVIRONMENT')
call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
call RxFuncAdd 'SysRmDir', 'RexxUtil', 'SysRmDir'
call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete'
call RxFuncAdd 'SysGetKey', 'RexxUtil', 'SysGetKey'
/* Make sure that this is truly what you want */
say "Is this TRULY what you want?  (Y/N)"
sure:
key = SysGetKey(noecho)   
select
     when key = 'n'
        then exit
    when key = 'N'
        then exit
    when key  'y'
        then If key  'Y'
            then signal sure
Otherwise
end

/* Check to make sure that the current directory (or previous or root) 
is not being deleted and that there is an argument */

select   
    when Arg(1) = ""
        then signal bye   
    when Arg(1) = '.'
        then signal bye
    when Arg(1) = '..'
        then signal bye
    when Arg(1) = '\'
        then signal bye
Otherwise 
End

/* Delete Directory */

rc = SysRmDir(Arg(1))
/* check to make sure directory to be deleted is deleteable */
If rc = 0
    Then call SysRmDir Arg(1)
Else          
     if rc = 3 then signal bye
Else
    If rc = 5  /* Attempts to remove any readonly bits then deletes 
files and finally rd directories */
        Then
        Do
            call SysFileTree Arg(1)'\*.*', 'file', 'BSO', '***+*', 
'***-*'  /* removes readonly bit */
            call SysFileTree Arg(1)'\*.*', 'file', 'FSO'
                do i=1 to file.0
                    call SysFileDelete file.i  /* deletes files in 
directories */
                end
            call SysFileTree Arg(1)'\*.*', 'direct', 'SDO'
            i = direct.0
             
            do while i0
                call SysRmDir direct.i /* deletes directories in tree in 
necessary order */
                i = i - 1
            end
            call SysRmDir Arg(1) /* deletes initial directory */
        end
 n = endlocal()     
Exit

bye:
    say 'Invalid or nonexistent directory'
n = endlocal()
exit


Andy

-- 
Warpstock 2004, Denver, Colorado, October 21 - 24, 2004
http://www.warpstock.org Volunteers:  please send note to
wsv2004{at}comcast.net



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/E8folB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

 To visit your group on the web, go to:
    http://groups.yahoo.com/group/os2user/

 To unsubscribe from this group, send an email to:
    os2user-unsubscribe{at}yahoogroups.com

 Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




---
* Origin: Waldo's Place USA Internet Gateway (1:3634/1000)
SEEN-BY: 633/267 270
@PATH: 3634/1000 12 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.