I'm trying to come up with a name for a class that can represent both files and folders. Anyone know a word for this?
-
4I think this has been asked before but I can't seem to find it... I'd suggest "Filesystem Object". – FrustratedWithFormsDesigner Jan 16 '13 at 16:58
-
FileSystem node? – Oded Jan 16 '13 at 17:16
-
3If you are developing in the Windows environment, I would not recommend "Filesystem Object", since this has already a different meaning (it means a special COM object provided by Microsoft as part of the Scripting Runtime library, see http://msdn.microsoft.com/en-us/library/aa242706%28v=vs.60%29.aspx) – Doc Brown Jan 16 '13 at 18:56
-
1Folder entry? http://www.ntfs.com/fat-folder-structure.htm – rwong Sep 17 '13 at 09:07
-
If you google "folder" and "file" you get back the same image results (so they share similar meaning), which makes me think that you can just call both files and folders "file" just like linux does it. – Timo Huovinen Nov 11 '20 at 10:24
4 Answers
Consider FileNode
or FileSystemNode
.
I've used FileNode
in previous projects, the other devs were able to guess what it did from the name. The -Node
part lets others know you're working with a tree.

- 1,786
-
1I prefer
FileSystemNode
, asFileNode
sounds like it might be specific to files. – Brian Sep 17 '13 at 12:52
As everything (except the root folder or root of a drive) is ultimately contained within a folder, you could just go for FolderElement
, although FilesystemObject
(as suggested by @FrustratedWithFormsDesigner in a comment) also sounds good.

- 74,630
It depends on the operating system and the file system. On Unix, a directory is just a special file, so the correct term would be file.
NTFS has a similar unifying concept, albeit much more complex than on Unix, called attribute.

- 103,514
-
2Although technically correct, I feel that most people would assume a class "file" is associated with documents, not folders. – Cavyn VonDeylen Jan 16 '13 at 17:27
-
3Documents are yet another can of worms entirely. A single document may be split across multiple files and a single file may contain multiple documents. – Jörg W Mittag Jan 16 '13 at 17:39
-
8
Why don't you just call you class "FilesAndFolders" or do you have a character-limit for naming? Well I guess you could call all of them entities, so: "FileSystemEntity"

- 13,220