File or Directory Attributes


Home     Sitemap

Change a file or directory attributes (folder) to recover from a virus attack...

Sometimes a corrupt file system will change access to files, sometimes it is a virus, and sometimes it is a user with the wrong set of rights. Either way a hidden or read only will keep you from using a file.

Note: File attributes control how a document is viewed or changed therefore consider this before you change an attribute:

Removing the system, read only, or hidden characteristic from system files gives an opening for someone or a virus to change or delete these files.

Use this information with caution, insure you are in the correct place before executing the commands while changing a file or directory attributes!

Seems there is a nasty virus out on the web that likes to hide directories (Folders) and files from the user/owner. This is called Change A File or Directory Attributes.

Change A File or Directory Attributes:

You tried to remove the hidden attribute on some files and folders with Explorer but it isn't working.

You need to have two things:

  • Administrator Rights and
  • Ownership of the files/folders

First you need to check the security of the drive volume in question, with the properties window open on the drive you need to find out who owns the files on the volume, go to the Security tab.

Then highlight Administrators (computername\Administrators), then go down to the "Advanced" button and click it.

On the Owner tab you should see Administrators and your user ID if you do not see your user ID then you DO NOT have Administrative rights on the computer! You need to either log on with the Administrator's ID or add your user ID to the Administrators Group.

You need this in your IT Tool Box! Get yours today...

The 5 Steps to high quality and cheap
DIY Computer Repairs

Get It Today...

If you are not sure that you "Own" the files then close the drive properties and open Explorer, go to the Folder in question and check the properties, Go to the Owner tab and look at the "Owner" if your user ID is there, highlight your user ID the check the box "Replace owner on sub containers and objects" this will give you ownership of the Folder and all sub folders and files under that folder.

Windows 7 security attributes are different than XP or older Windows Operating Systems  - Do NOT use XP or an older Windows Operating System to Change A File or Directory Attributes on a Windows 7 or Vista partition or volume, you may corrupt the drive and make the data unusable or not recoverable.

You can use the command prompt to change the attributes because it uses a direct access, not a file system or file manager to change the hidden or read only attributes.

From there you should be able to use Explorer to change the hidden attribute from the folder, sub folders, and files.

Note: A while back I wrote an article about how to change a file or directory attributes by using the CMD Prompt or DOS Box to change the properties or attribute of a file.

If not read on ~

Change a file or directory attributes using the CMD prompt:

One of the ways to gain control over a file or directory (this is an old DOS term where as Folders is a Windows 95 and up term) is to use the Command Prompt (CMD prompt) and go to the directory with the effected files.

Ah but, you say "How do I get there?"

Here is a tip: If you need to know a certain command for working in the DOS environment then press F1 and in search box type in "Command-line reference".

Now you have a list of all the commands you can use in the Command Prompt window or with a DOS boot disk, however with a DOS boot disk unless you have a utility that will mount an NTFS volume you will not be able to do anything to a Windows volume, DOS can not see the NTFS formatted volume.

Either use the Start button menu and navigate to the accessories and open a Command Prompt window or use the Run... from the Start button menu and type in cmd, a new window will open at the Command Prompt.

Change a file or directory attributes...

Next you need to navigate to the actual directory, lets say the path to the affected files is D:\Backup Files\June 2010 now you have a small problem because some DOS commands do not see spaces in a directory name, and when you get to the files you are going to have another problem: DOS can only see eight characters and a three character file type extension.

There are ways around these small problems. When you are using some commands/utility programs in the CMD Prompt you can not use spaces and long file names with some commands such as attrib unless you enter your text with in parentheses such as you want to go to the backup files directory you would use this: "backup files" with the command.

Before you go to the backup files directory if it is hidden you need to remove that attribute by using the attrib -h command (don't worry I will make a complete list of how to get to the drive letter, the directory, and the files shortly).

When the CMD Prompt window opens it will be on your Operating System drive and in your home or My Documents directory unless you have changed it by changing the properties of the CMD Prompt itself (I have mine set for C:\ ) so you need to get to the D: drive then to the backup files root directory for the June 2010. That is where you need to start removing the -h (hidden) attribute from the files and directories.

Your command prompt may look like this:  C:\>   The drive letter may be different or the path between the \ and the > maybe longer, it may have your home directory in it of it may even be a shared drive on a local server. I am leaving off the prompt to make each command easier to understand.

Change a file or directory attributes CMD prompt instructions:

Next you go to your CMD Prompt and use the DOS syntax (type in the command - commands are all bold - explanations are not) as follows:

Change the cmd prompt to the drive volume you want to work with (if it is the C: drive then skip this step)

  • D:

Next look for your directory:

  • dir /a:h

You should see a list of hidden directories at the root of the D: drive or volume, find yours:

  • 01/05/2010  09:20 AM     <DIR>                   Backup Files

Remove the hidden file attribute from the directory 'Backup Files':

  • attrib -h "backup files" (you have to use the parentheses because of the space in the directory name for DOS commands)

Check to see if the attribute change worked:

  • attrib "backup files" (there should not be any attributes on the directory however some programs make the root directory read only, leave that as is).

Change to the root directory you need to work with:

  • cd D:\backup files (at the CMD Prompt you do not all ways have to use the parentheses)

Check the directory for hidden files:

  • dir /a:h

Here is your file:

  • 01/05/2010  10:17 AM   469,286 your hidden file you are looking for

Now you can change the attributes on all the files (*.* is a wildcard expression that will include all files and extensions) in the 'backup files' directory:

  • attrib -h *.*

Then use the dir command to list all the files by name and extension, however directories (or folders) will be listed with the this:

  • dir

 The name of the directory lists like this:

  • 01/05/2010  09:20 AM     <DIR>   Backup Files (Your hidden directory )

Files will be listed like this:

  • 01/05/2010  10:17 AM   469,286 your hidden file you are looking for

To check if the command worked pick one of the files, to see the files in the directory use:

  • attrib "your hidden file you are looking for"

The command will list the attributes like this:

  • D:\Backup Files\June 2010\your hidden file you are looking for

If it didn't change it will look like this:

  • H    D:\Backup Files\June 2010\your hidden file you are looking for

Suppose that a program has made the directory  and the file not read only? What would the folder attribute look like?

  • R    D:\Backup Files\June 2010\

What would the complete path look like?

  • D:\Backup Files\June 2010\your hidden file you are looking for

Once you have removed the hidden attribute from the files and folder then using Explorer check your work by doing a properties on the folder then some of the files in the folder.

Change a file or directory attributes:

But you say "There are folders inside the D:\Backup Files\June 2010\ folder!"

Then you would have to run the attrib command on each directory then inside each directory, yes it is a lot of work but if Explorer can't do the job and you don't have the old NT File Manager then you will have to do it the hard way, one folder at a time.

Note: For Vista and up I tested a program called Explorer++ (Explore plusplus) and it will not change the hidden attribute, it will change the read only but not the hidden.

A list of commands that I used to change a file or directory attributes in this example:

  • D: - change to D volume or drive
  • dir - list all directories and files
  • cd - change directory
  • attrib - attribute command
  • attrib /a:h  (the switch a:h tells the attribute command to display only hidden files or directories)
  • attrib -h - remove the hidden attribute on a file or directory

What if you copied some files from a CD or DVD? Did you know that the files on a CD or DVD have the Read Only attribute? When you copy the files the attribute follows and all files copied will be read only. Normally that will be ok but if you need to change a file or directory attributes or if a file is a template that you want to use you will not be able to save your work until you remove the read only attribute or use a different name for the file.

You can use Explorer to remove the read only but if Explorer can't remove the attribute then use the steps above and replace the letter h with the letter r.

Last thing:

Do NOT use the attrib command on the Root of the Operating System drive (normally C: ) because removing the system, read only, and hidden attributes of the system files invites disaster, a virus may not have the commands built in to change attributes but if you do it for the virus then those files could be removed, damaged, or changed.

Change A File or Directory Attributes is fairly easy to use once you understand the syntax (options) that are used to set the attribute.


If you are using Windows 7 / 8 / 10 or Vista and are on the System partition (normally known as the C: drive) be very careful with taking ownership of folders, mainly the USERS folder, taking ownership of the USERS folder may lock out other user ID's on that computer. Why mess around with security and ownership when this is so much faster?

You could use a bootable media such as your own custom ERD for Vista and newer Operating Systems to change a file or directory attributes but then you would have to make it first...

Click here to find out how to make one ...

Emergency Repair
isk (ERD) - Will Yours Work?

Repair Disk

Custom made for you...

You keyboard isn't thirsty, and it doesn't need calcium. Milk and other liquids will ruin a keyaboard!

This Web
Site is a
labor of Love
But Love
doesn't pay
the bills!

Please chip in $5 to keep it live...

Need A Checklist?

Need A Repair Manual?

    Page copy protected against web site content infringement by Copyscape

You can:

Return to
previous page:





Thank you for visiting my web site, and please come back again.

This website is not intended for children under the age of 18

Author of this web site: Monte Russell

FTC Endorsement Rules
All testimonials on the DIY Computer Repair web site are from customers who were not paid to comment on any products!

The Flag of The United States of America!   Proudly Made in The U. S. A.

Copyright and Registered to, all thieves will be prosecuted to the fullest extent of international law!

From the Desert South West ~ Arizona, U. S. A.
Copyright DIY-Computer-Repair.Com 2006-2016


"You found this web site through:"

Active Search Results

Return to top of File or Directory Attributes

Change A File or Directory Attributes

Home    About    Sitemap
Fix It Blog!

From the Desert South West ~ Arizona, USA
Copyright 2006-2015