Archive: Possible to include all files in a directory, and make them hidden?


Possible to include all files in a directory, and make them hidden?
I'm wondering if there's some way to include all files and subfolders in a directory, but make them hidden?

I see the SetFileAttributes command, but I don't see a way to combine this with the File command.

I'm including all the files and subfolders in a directory like this:

File /r "C:\files\*"


Is there a way to do that, but make all the files hidden?


!macro _HideAll Folder Hide
Push $R0
Push $R1

ClearErrors
FindFirst $R0 $R1 `${Folder}\*.*`
${DoUntil} ${Errors}

${If} $R1 != .
${AndIf} $R1 != ..
!if `${Hide}` == true
SetFileAttributes `${Folder}\$R1` HIDDEN|SYSTEM
!else
SetFileAttributes `${Folder}\$R1` NORMAL
!endif
${EndIf}

ClearErrors
FindNext $R0 $R1
${Loop}
FindClose $R0

Pop $R1
Pop $R0
!macroend
!define HideAll `!insertmacro _HideAll`
${HideAll} $INSTDIR\files true

If you want to hide files in the sub folders too then you'll need to use a recursive search using a Wiki macro or the Locate plug-in.

Stu