如果移动或重命名文件夹或文件错误消息生成,我需要文件或文件夹...
如果文件夹移动或复制,则记录在文本文件中,例如日志...生成
If txtSearchitem.Text <> "" Then
Dim filepath As String = txtSearchitem.Text
Dim dir As DirectoryInfo = New DirectoryInfo(filepath)
Dim user = New SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, Nothing)
Dim Security As DirectorySecurity = dir.GetAccessControl()
Security.AddAccessRule(New FileSystemAccessRule(user, FileSystemRights.FullControl, AccessControlType.Allow))
Security.AddAccessRule(New FileSystemAccessRule(user, FileSystemRights.ReadAndExecute, AccessControlType.Allow))
dir.SetAccessControl(Security)
MsgBox("Folder is unlocked", vbInformation, "Unlock")
txtSearchitem.Text = ""
Else
MsgBox("Please browse the folder to lock.", vbInformation, "lock")
End If