31

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 represented by the word ....

6
  • 2
    Well.. In java both files and folder are referenced as a file.. Commented Apr 24, 2013 at 17:13
  • Hmmm... I would also be printing some text that has contains "files or folders" ... Just wanted a word to identify them both in normal language, but thank you for that tidbit. Commented Apr 24, 2013 at 17:16
  • 1
    File system resource? File system object? Commented Apr 24, 2013 at 17:18
  • 4
    Why not just Path ? (it can point to a file or a folder) Commented Apr 24, 2013 at 17:18
  • 2
    Here is a related thread on the 'programmers' stackexchange. word-for-the-superset-of-files-and-folders I think that File System 'something' is the closest - i.e. FileSystemEntry or Object, Item - or FSNode as recommended in the link. Commented Apr 24, 2013 at 18:18

4 Answers 4

17

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.

Sign up to request clarification or add additional context in comments.

1 Comment

fsNode is perfect in word length.
6

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

1 Comment

The problem with calling it a path is that that normally refers to a complete path, e.g. '/var/tmp/whatever.txt'. When talking about just 'whatever.txt' you're not really talking about a path, you're just talking about an entry. That's why I prefer @OCDev's answer.
1

Dart uses FileSystemEntity for such case. Reference here.

Comments

0

What about dirent?

I think this term comes from node, it's short for directory entry. https://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.