Archive: SetFileAttributes problem


SetFileAttributes problem
I'm using NSIS 1.98.

The documentation says that SetFileAttributes accepts wildcards. When I try to use them, however, the command doesn't work, and the errors flag is set. Using the command without wildcards works.

For example:

; this doesn't work
SetFileAttributes "$INSTDIR\subDir\*.*" READONLY

; this works
SetFileAttributes "$INSTDIR\subDir\somefile.txt" READONLY


Is this a bug, or am I doing something wrong?


you could do a loop detecting every single file in the dir and change the attributes of each.


It's not a bug. The documentation is just wrong.
Like killahbite said, you can make a loop using FindFirst, FindNext and FindNext and change them one by one.


thanks guys


Originally posted by kichik
It's not a bug. The documentation is just wrong.
Like killahbite said, you can make a loop using FindFirst, FindNext and FindNext and change them one by one.
Wouldn't it be an idea if wildcards are supported? It would make looping unnescessary, and the script will be better readable.

Microsoft doesn't support this and I won't include wildcards support inside NSIS, that's not necessary.


Exec Attrib ...
Couldn't you Exec the Attrib command to do it?


Then you should also log output to some temp file (and delete it) otherwise a dos box will pop up.

But I can remember I wrote some function for these things (changing all attributes in a specific dir), but I do not have the source with me now. Maybe it is on Sunjammers site. I would propose you have a look there.

:-H

[edit]
OK, here's the link: http://www.clantpa.co.uk/nsis/wiki/index.php/Attrib
[/edit]


My solution to the the same problem is to use the
execshell attrib
:)