Page 1 of 1

SetFileAttributes() for folder/directory

Posted: Wed Mar 11, 2020 2:24 pm
by BlindMan
SetFileAttributes() for a folder/directory doesn't appear to be working for +s or +h.
Passing full pathname of folder to SetFileAttributes().
Working as expected on files.
Using Win10x64 PB5.72x64 B2

Sorry. Working ok now. Not sure why. Computer has been switched off and on since last tested but code has not changed.

Code: Select all

 

ProgDataDir$ = GetUserDirectory(#PB_Directory_ProgramData)

DirSeparator$ = Right(ProgDataDir$, 1)

 

CreateDirectory(ProgDataDir$ + "BangMash")

Result = SetFileAttributes(ProgDataDir$ + "BangMash", #PB_FileSystem_Hidden)

MessageRequester("Result " + Str(Result), ProgDataDir$ + "BangMash")

 

CreateDirectory(ProgDataDir$ + "BangMash" + DirSeparator$ + "Bang")

 

CreateDirectory(ProgDataDir$ + "BangMash" + DirSeparator$ + "Mash")

Result = SetFileAttributes(ProgDataDir$ + "BangMash" + DirSeparator$ + "Bang", #PB_FileSystem_System)

MessageRequester("Result " + Str(Result), ProgDataDir$ + "BangMash" + DirSeparator$ + "Bang")

 

End


Re: SetFileAttributes() for folder/directory

Posted: Wed Mar 11, 2020 3:04 pm
by Little John