0

In computer science, I found the word "directory name" seems to describe path of the directory. (because when you use dirname command in linux you get path)

Then what word(s) do you use to describe only the name of the directory?

For example, if there is directories as follow,

"C:\folder1\filename.xml"

"folder1" is what I want to describe, not "C:\folder1"

2
  • 1
    The directory name usually just means the actual directory (or 'folder') , 'folder1' in your example. A 'path' contains more than one directory, maybe starting from the drive root or mount point, e.g. /mnt/archive/systemlogs/december/mon23/. Dec 23, 2019 at 10:03
  • 2
    Computer Science SE (which has a terminology tag) is the more obvious fit here. Dec 23, 2019 at 14:46

1 Answer 1

0

There are two complimentary commands for parsing a pathname:

Path             Dirname       Basename
one/two/three    one/two       three
/a/b/c           /a/b          c
./x/y/           ./x           y

The dirname and basename commands were given their names early in UNIX history, so don't rely on their having any consistent naming convention.

Assuming that three and c are files and not directories, generally, one would say:

  • File paths: ./one/two/three, /a/b/c
  • File names: three and c
  • Directory names: two, b, and x
  • Directory paths: one/two, /a/b, and .

The Directory names and paths could also be given a trailing / to make it more obvious that they aren't files.

So in your non-UNIX (C:\folder1\filename.xml) example, filename.xml would be the filename and folder1 would be the directory name.

E.g. "filename.xml is a file in the folder1 directory."

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.