Does folders in windows have IDs? or GUIDs?

2019-07-18 07:47发布

what I'm trying to do, I'm selecting a folder and copying it, I would like to avoid copying it again if the folder got renamed. so is there an ID for each folder in windows that stick with the folder till its deleted ?

C# would be perfect, or C++

2条回答
ら.Afraid
2楼-- · 2019-07-18 08:26

I dont think there is a way to find out for folders.

查看更多
孤傲高冷的网名
3楼-- · 2019-07-18 08:29

I think you looking somewhat like this :Unique file ids for Windows - Unique ID for files on NTFS?

Windows can give a unique file indentifier using the function GetFileInformationByHandle()

Example: (hFile is a handle to a file)

BY_HANDLE_FILE_INFORMATION FileInfo;

GetFileInformationByHandle(hFile, &FileInfo);
inode= FileInfo.nFileIndexLow | (FileInfo.nFileIndexHigh << 32);
volume=FileInfo.dwVolumeSerialNumber;

I got similar SO thread here, that will help you implement that you are looking for..

Unique File Identifier ane Unique Folder Identifier

查看更多
登录 后发表回答