Archive: How to use SetFileAttributes on multiple files (*.txt)


How to use SetFileAttributes on multiple files (*.txt)
I'm installing a directory of files with the below. I don't know what files will be there, but the idea is to grab whatever files are there and put them into the install directory.


SetOutPath "$INSTDIR\MyTextFiles"
File "${TEXTFILESFORINSTALLER}\*.txt"
SetOutPath "$INSTDIR"


I'd like to set the read-only attribute on these files. I found the SetFileAttributes command which looks like what I need. The problem is, it appears to only apply to a single file. Since I don't know what files will be there, I can't explicitly call it once for each file.

Any ideas? I need to call SetFileAttributes on all the .txt files in the directory.

http://forums.winamp.com/showthread.php?t=349039


Thanks, that worked! Here's what I used for reference.


; set my text files as readonly
FindFirst $0 $1 "$INSTDIR\MyTextFiles\*.txt"
txtFilesReadOnlyLoop:
StrCmp $1 "" txtFilesReadOnlyLoopDone
SetFileAttributes "$INSTDIR\MyTextFiles\$1" FILE_ATTRIBUTE_READONLY
FindNext $0 $1
Goto txtFilesReadOnlyLoop
txtFilesReadOnlyLoopDone:
FindClose $0