28

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..
    – Menno
    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.
    – TheKobra
    Apr 24, 2013 at 17:16
  • 1
    File system resource? File system object?
    – Filip
    Apr 24, 2013 at 17:18
  • 4
    Why not just Path ? (it can point to a file or a folder) 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.
    – NSGaga
    Apr 24, 2013 at 18:18

3 Answers 3

14

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.

5

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
  • 4
    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.
    – Connor
    Jul 8, 2019 at 19:41
1

Dart uses FileSystemEntity for such case. Reference here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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