Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Windows recognizes files using extensions. Does same applies to folders? Is there a special extension that mark a file as a folder?

share|improve this question
4  
The file name extension denotes a file type. A folder is not a type of file, it's a folder. –  Oliver Salzburg Feb 21 '12 at 14:39

5 Answers 5

up vote 5 down vote accepted

There is no defined extension to a directory in Windows; rather, the type ("file" versus "directory") is kept in the master file table.

You should be able to see all files' extensions by just deselecting the "Hide extensions of known file types" in the folder options settings. Or you can type command dir from command line to see the files with extensions. And you would see that the folder namess do not have any extra extensions...

share|improve this answer
1  
So you are saying there a type flag in file system that specifies whether a file is a normal file or folder ? –  Serious Feb 21 '12 at 14:57
    
The linux maintains a flag to differentiate between a regular file, a directory file, a character device file, a block device file, etc... Windows also should be maintaining something similar.... –  Mallik Feb 21 '12 at 15:08
5  
Pretty much all file systems keep such an attribute. Windows NTFS has a separate "DIRECTORY" flag in the MFT record, but the actual object type greatly depends on presence of named attributes; for example, a symbolic link can also have the "DIRECTORY" flag, but it has the $REPARSE_POINT attribute containing the target and lacks $INDEX_ALLOCATION which would otherwise contain the file names. Meanwhile, in Linux ext2/3/4 the "type" is simply part of the "permission bits" - 041777 is a directory with permissions 01777, and 0100644 is a regular file with permissions 0644. –  grawity Feb 21 '12 at 15:29
1  
On the other hand, VMS (which could, in a way, be considered a parent of Windows NT) does have a special extension for directories -- .DIR -- and they can be managed very similarly to files; doing dir [.notes] just looks for a file named notes.dir in the default directory; one can even do type notes.dir to see the raw contents. (On Linux, converting a directory to a file cannot be done without resorting to debugfs or similar tools, and is damn near impossible on Windows NTFS. Some BSDs do still allow cat'ing directories, though.) –  grawity Feb 21 '12 at 15:35
    
(Disclaimer: Original research using debugfs and ntfsinfo. No guarantee of accuracy.) –  grawity Feb 21 '12 at 15:41

Folders are a different type object. They don't have to have a extension to identify them as folders.

The name can consist of any valid characters and that includes ".", so you can call a folder:

test.txt
test.png
etc.

share|improve this answer

As others have said, Windows doesn't use filename extensions to identify folders. Folders, also called directories, are actually files but they have a FileAttribute value that identifies them as folders rather than regular files.

At a command prompt, you can type:

c:\temp> dir /a:d

which means, list all the files with the directory attribute, i.e., list of the folders in the current folder (c:\temp). Type dir /? for other options.

In Windows Explorer (for Windows Vista and Windows 7) you can specify a search filter of kind:folder to find the subfolders of the selected location.

There are other FileAttribute values, too; Archive, Compressed, Encrypted are some of the more common ones. You can use scripting and programming languages to examine these attributes. Here's a post on the Scripting Guys blog about using PowerShell to work with file attributes.

FWIW, although you can name a directory something like test.png, I think that's likely to create confusion. Windows won't care, but users might.

share|improve this answer
1  
FWIW, physically, the "Directory" flag is stored separately in the MFT record flags, not as part of the "File attributes" field. –  grawity Feb 21 '12 at 15:18

Note that the correct answers here notwithstanding, windows does in fact attempt to classify a folder by its contents and change the presentation based upon the classification.

This classification is called a Folder Type and windows has what is typically called Automatic Folder Type Discovery.

Unfortunately, sometimes merely dropping an mp3 file into a folder changes it's template to "music" even though the other 100 files are txt docs etc.: I don't need to rate my README.TXT as 5 stars with a run length of UNDEFINED.

Altering the behavior requires editing the registry, as far as a I know.

share|improve this answer

I wish somebody could know too the FOLDER ext. If there really is one like the recycle bin... You can make a folder and change it to recycle bin by adding without the quote ".{645FF040-5081-101B-9F08-00AA002F954E}" as its extension...

By this, you can confuse other users and if they try to open your folder (that is changed into recycle bin" they will never get to it instead they will be opening the recycle bin's contents... You can set it to HIDDEN also for another level of security...

Be sure to hide all don't forget that it's your system folders and extension after doing so....

Also NEVER FORGET THAT IT'S YOU FOLDER...

You can make a batch file for that certain purpose: just put this in notepad:

@echo off
ren FOLDER XFILES.{645FF040-5081-101B-9F08-00AA002F954E}
attrib +r +a +s +h XFILES.{645FF040-5081-101B-9F08-00AA002F954E}

SAVE THIS AS MODIFY.bat or BAT.bat, then to OPEN it for later use use this on another notepad or wordpad:

@echo off
attrib -r -a -s -h XFILES.{645FF040-5081-101B-9F08-00AA002F954E}
ren XFILES.{645FF040-5081-101B-9F08-00AA002F954E} FOLDER

SAVE THIS AS SHOW.bat of UNLOCK.bat.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.