[comp.os.msdos.programmer] Read-Only Directories in DOS

dtymon@cs.uq.oz.au (David Tymon) (04/26/91)

  Is it possible to create read-only directories in DOS ?

  I have tried setting the ReadOnly attribute but all this does is
  prevent me from removing the directory but I can still create, edit
  and delete files in the directory.


  Surely all that needs to be done is prevent the file containing the
  directory information (ie: name,location,size,date etc) from being 
  updated.

  Any help on the subject would be much appreciated.

                          David Tymon

resnicks@netcom.COM (Steve Resnick) (04/26/91)

In article <985@uqcspe.cs.uq.oz.au> dtymon@cs.uq.oz.au writes:
>
>  Is it possible to create read-only directories in DOS ?
>
>  I have tried setting the ReadOnly attribute but all this does is
>  prevent me from removing the directory but I can still create, edit
>  and delete files in the directory.
>
>
>  Surely all that needs to be done is prevent the file containing the
>  directory information (ie: name,location,size,date etc) from being 
>  updated.
>
>  Any help on the subject would be much appreciated.
>

DOS doesn't use files to store directory information. The directory
information is stored in the FAT just like other file information. 

You can set hidden and other attributes on the directory, but they 
only affect the directory name, not the contents. (Which is too bad IMHO)

Cheers!
Steve



-- 
-------------------------------------------------------------------------------
	resnicks@netcom.com, steve@camphq, IFNA:	1:143/105.0, 
USNail: 530 Lawrence Expressway, Suite 374 
        Sunnyvale, Ca 94086

ekalenda@cup.portal.com (Edward John Kalenda) (04/27/91)

>>  Is it possible to create read-only directories in DOS ?
>>
>>  I have tried setting the ReadOnly attribute but all this does is
>>  prevent me from removing the directory but I can still create, edit
>>  and delete files in the directory.
>>
>>  Surely all that needs to be done is prevent the file containing the
>>  directory information (ie: name,location,size,date etc) from being 
>>  updated.

This would work except that DOS says "its a directory, I don't need to
do all that file processing" so it doesn't check for read-only and all
that stuff. The only way I've seen to do this is to write a TSR that
checks all file creates and renames (move equivelent) to see if the
target directory has the read-only bit set and deny the action.

>>
>>  Any help on the subject would be much appreciated.
>
>DOS doesn't use files to store directory information. The directory
>information is stored in the FAT just like other file information. 

Actually, ALL the information about a file except for the cluster
chaining is stored in the directory file. DOS does not treat the
directory like normal files. You can't open it or read it or anything.

Ed
ekalenda@cup.portal.com