Verify if file exists in the directory using the System.IO namespace. And retrieving the security information and other details. This as been demonstrated using the Windows forms application.
if (File.Exists(openFileDialog1.FileName))
{
//MessageBox.Show("File exists!");
lbl_existstatus.ForeColor = System.Drawing.Color.SeaGreen;
lbl_existstatus.Text = "File Exist the directory";
}
else
{
lbl_existstatus.ForeColor = System.Drawing.Color.Red;
lbl_existstatus.Text = "File Missing in the directory";
}
Query the secuirty inforamtion of the file using the System.Management.
using (ManagementObject o = new ManagementObject(@"Win32_LogicalFileSecuritySetting.Path='" + fileName + "'"))
for more download the sourcecode.
No comments:
Post a Comment