Recursiv set attrib flag bat-file

I need to make a solution that sets the attrib-flag for all files in a certain directory recursively (and all its subdirectories).

mdolandAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AmigoJackCommented:
you have to:

- click start-> run
- enter "cmd"
- enter "attrib /?"
- view what it prints
- change the directory to where you want to start with "cd c:\windows\thisone\" for example
- use the attrib-command. an example to recursively set the "readonly" attribute to every file would be: "attrib +H . /S"

if you want to set or release always the same attribute(s) then you could add such a static command to the context-menu (left mousebutton click) of any folder. when you would select that, always the same attributes would be set/released for all files within that folder and recursively all files in every sub-folder
0
mdolandAuthor Commented:
Great! Could you explain that thing with static command that could be possible to use throughthe mouse?
0
AmigoJackCommented:
sure. to do this, first make sure what you want with the attrib-command. the following example sets the readonly-attribute and removes the hidden-attribute. if you want something else, you have to adapt the example or say it here what you want. its done recursively for every sub-folder.

- click start->run
- enter "notepad"
- copy all lines below after the first === and before the second === marker into notepad
- save the file somewhere (best would be desktop) as "something.reg". make sure it really has a .REG -ending
- doubleclick on the REG-file and yes, youre sure to merge it with the registry
- thats it. now open up explorer, right click on any folder and you will see the new entry. selecting this will execute the attrib-command like described above.

if you see the example but want to change something, simply edit the reg-file in notepad again, save it and then doubleclick it again - there is no "uninstall" orso to care about, the changes affect the system instantly.

===============start=================
REGEDIT4

[HKEY_CLASSES_ROOT\Directory\shell\myattrib]
@="here goes my description"

[HKEY_CLASSES_ROOT\Directory\shell\myattrib\command]
@="attrib +R -H \"%1\"\\*.* /S"

===============end=================

have fun :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.