Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set clear attribute "X" on files with in C#?

Tags:

I have a hidden file on my USB removable storage (FAT file system).

I'm using Windows 7. If I go to Properties window of this file and then to the Details tab, I will see that the attributes of the file are HX. When I run cmd and use attrib, I was told that file has attribute H. Nothing about X. I've tried help attrib, but still nothing about attribute X.

I know that:

  • H = Hidden
  • S = System
  • A = Archival
  • R = Readonly

However, I have no idea what X stands for. I've also found what the N and E attributes are for.

Wikipedia has no mention of what the X attribute is.

Google found two topics mentioning attribute X:

  • undeletable file in delphi
  • file attribute of x.
  • "better attrib"

None of these helped.

I'd like to be able to read/write this flag in C#, but so far I read the documentation for the FileAttributes enumeration and experimented with setting some of listed attributes (using File.GetAttributes & File.SetAttributes methods) on the file.

None of these experiments resulted in attribute X showing up in Properties -> Details. So, I have no idea how to approach it, especially since I still don't know what attribute X means.

So, what is attribute X and how can one set/clear it on the selected file in C#?

like image 710
beam022 Avatar asked Dec 23 '11 15:12

beam022


People also ask

How do I remove a file attribute?

Open File Explorer and go to the folder that contains your files. Select the file whose attributes you want to change. On the Home tab of the Ribbon, click on the Properties button. In the next dialog, under Attributes, you can set or remove the Read-only and Hidden attributes.

How do I change hidden attributes on a file?

Changing file attributes To view or change the attributes of a file, right-click the file, and then click Properties. In the "Attributes:" section, enabled attributes have checks beside them. Add or remove the checks from Read-only, Archive, or Hidden to enable or disable these options.

Which command is used to list the attributes of a file?

ls lists files and directories. If the pathname is a file, ls displays information about the file according to the requested options. If it is a directory, ls displays information about the files and subdirectories therein. You can get information about a directory itself using the –d option.

What is attribute file in Linux?

In Linux, file attributes are meta-data properties that describe the file's behavior. For example, an attribute can indicate whether a file is compressed or specify if the file can be deleted. Some attributes like immutability can be set or cleared, while others like encryption are read-only and can only be viewed.


1 Answers

Maybe I'm wrong but... I think that X attribute means that the file has extended attributes. Unfortunately, extended attributes can't be modified using C#.

like image 165
CedX Avatar answered Sep 30 '22 16:09

CedX