如何使用Go翻转文件的Windows存档位

I am processing a series of files using Go and I would like to indicate if a file has been processed using file metadata. If the file has been processed at least once but hasn't been processed by the program for an hour I would like to delete it.

I thought the Windows archive bit would be a good way of determining if the file has been processed at least once since these files are temporary and will not be backed up preventing accidental flipping of the Windows archive bit.

Use the Microsoft Windows API:


Retrieving and Changing File Attributes

An application can retrieve the file attributes by using the GetFileAttributes or GetFileAttributesEx function. The CreateFile and SetFileAttributes functions can set many of the attributes.


package windows

import "golang.org/x/sys/windows"

func GetFileAttributes

func GetFileAttributesEx

func SetFileAttributes