Link to home
Start Free TrialLog in
Avatar of wrandy
wrandy

asked on

Directory atrributes

Is there a way, (or utility)to changes the attributes on directories only ( not the files inside). I have hundreds of directories with thousands of subdirectories that I would like to change to read only. With out going through each one.
Avatar of sdczerno
sdczerno

The only way I know how to do this is in Explorer. Click on the Root Directory where all you sub-directories are then in the right windows select all folders and then click your right mouse on the highlighted folder(s) and check "read-only". Hope this helps.
Avatar of wrandy

ASKER

That is the default way, but does not flow down to all subdirectories below. This answer should have been tested before given.

Select the directory, right click, go to Find, and hit Find now.  This will show all files, and folders under this directory. (granted you are set up to show hidden files) Select all, Right click, go to Properties, and check Read Only.

This works for me.  If it doesn't work for you, let me know.
ATTRIB *. /S +R

Avatar of wrandy

ASKER

This does not flow down through subdirectories.I hve thousands of subdirectories.
Avatar of wrandy

ASKER

ATTRIB *. /S +R  changes all the files also. I do not want this.
attrib +h DIRNAME
does that also hide the files inside the directory "DIRNAME" ?
"Directories only"  Missed that, sorry.

Still using my method, under advanced/Of type, select Folder.  You may run into a search limit though.

Please specify opperating system, as I assumed Windows 95.
Run Winfile from a run prompt. Select the drive in the left pane and then select the directories you want to adjust in the right pane. Click File and then Properties. You then get a box with the attributes. Change as needed. If you are adjusting hidden directories then you need to select View, By File Type, and click the Show Hidden/System files box first.
"Directories only"  Missed that, sorry.

Still using my method, under advanced/Of type, select Folder.  You may run into a search limit though.

Please specify opperating system, as I assumed Windows 95.
Avatar of wrandy

ASKER

once again, this works on files in a directory, but I want only directories and subs to be changed. also, the subs go very deep and i don't wnat to select each one.
Thanks to all. but I have came up with the answer. I will post shortly.
Maybe Im missing something. This works for me on dubdirectories.  I'll wait for your post.
I can generate a list of directories that need to be processed easily enough with:

DIR \ /AD /B /ON /-P /S > X

Having done that you'll have to use:

OPEN "X" FOR INPUT AS #1
OPEN "FIX.BAT" FOR OUTPUT AS #2
PRINT #2, "@ECHO OFF"
DO WHILE NOT EOF(1)
    LINE INPUT #1, Text
    PRINT #2, "ATTRIB " & Text & " +R"
LOOP
CLOSE
SHELL( environ("Comspec") & " /C FIX.BAT", 1)

Avatar of wrandy

ASKER

My bad. Jason_s got it. I overlooked running find again after going to  advanced and selecting "FOLDER" .
This does catch directories only and all subs on down.
ASKER CERTIFIED SOLUTION
Avatar of Jason_S
Jason_S

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wrandy

ASKER

Great Job. Thanks to everyone. jason_s, thanks for not giving up. sometimes (in your case) you know your right, and wonder if the one on the other end is nuts.
I hope I can help others in the future.

Were all nuts from time to time.  : P