Archive: How to set Readonly property of all the files in a particular folder


How to set Readonly property of all the files in a particular folder
Hi to all,

I have tried the following for a single file and its working fine.

setFileAttributes "$INSTDIR\sample\File.txt" READONLY

But i want to set all the files like .txt, .c, .h of a particular folder in
ReadOnly mode.

How to do it.

Thanks in advance...:)


Use the Find* functions in a loop...


sorry I couldn't get it.. pls give with a simple example..

Actually my requirement is have to set all the files in a folder in read only mode.


Use FindFirst/FindNext/FindClose in a loop to find all *.someextension files. Then call setfileattributes for each file that's found.
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.5.12


Read only property for a folder
ya thanks, it's working fine..

Instead of doing like this is it any way to set a whole folder and its sub directories in read only mode...?


If you were programming in Win32 and the folder was on a NTFS drive you could use transactions, I don't really see the point though...