Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a name that can represent both a file or directory?

Tags:

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 ....

like image 514
TheKobra Avatar asked Apr 24 '13 16:04

TheKobra


People also ask

What are files and directories called?

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.

Can a file and directory have the same name?

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.

What is the name of a directory?

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.

What is a good file name?

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.


2 Answers

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.

like image 180
OCDev Avatar answered Sep 29 '22 10:09

OCDev


I usually just call it path

  • configPath could mean a file or folder and is generic
  • configFilePath can be specific to files
  • configDirPath can be specific to folders
like image 29
axsuul Avatar answered Sep 29 '22 09:09

axsuul