I am naming some variables in my code and I am trying to avoid naming things such as nameOfFileOrFolder
or pathOfFileOrFolder
. What is a good name or way to represent both of them? Does one exist?
For example:
A girl or boy can be both represented by the word person.
A cat or dog can both be represented by the word pet or animal OR mammal.
A file or directory can both be represeted by the word ....
The part of the operating system responsible for managing files and directories is called the file system. It organizes our data into files, which hold information, and directories (also called "folders"), which hold files or other directories.
A directory is a special kind of a file - one that doesn't have any data of its own, but a list of other files it contains. Like with any other file, you can't have two files with the same name in the same location, regardless of whether they are regular files, directories, symbolic links, named pipes, or whatever.
A directory name is a string that must name a directory if it names any file at all. A directory is actually a kind of file, and it has a file name (called the directory file name), which is related to the directory name but is typically not identical.
A good file name is one that enables not just its creator but also anyone else within the institution to identify its content and context and to make a decision about its relevance without having to open the file itself. In order to achieve this a file name should be: Objective. Meaningful.
The Software Engineering Stack Exchange has a good discussion about this:
Word for the superset of files and folders - Stack Exchange
You could call it FileSystemEntry
, FileSystemObject
, FileSystemNode
or FSNode
.
I usually just call it path
configPath
could mean a file or folder and is genericconfigFilePath
can be specific to filesconfigDirPath
can be specific to foldersIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With