我正在使用 Go 处理一系列文件,我想指出文件是否已使用文件元数据进行处理。如果文件至少被处理过一次,但程序在一个小时内未处理,我想将其删除。
我认为 Windows 归档位是确定文件是否至少被处理过一次的好方法,因为这些文件是临时文件并且不会被备份以防止意外翻转 Windows 归档位。
最佳答案
使用 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.
import "golang.org/x/sys/windows"
关于windows - 如何使用 Go 翻转文件的 Windows 存档位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44972209/