Filename And Pathname

Q2. How is a filename different from pathname? Support your answer with examples.

Ans. Filename:

Each file storedd on the system is given a name. The file name has two parts:

(i) primary file name and

(ii) secondary file name (also called extension)


A primary file name consists of one to eight (1-8) characters in length. File extension consists of a period followed by zero to three (0-3) characters. Extensions are optional, but it is better to use them as they are useful for describing the contents of a file. For instance, all document files can be given an extension .doc. The primary file name and extensions can have any characters other than following:

Extension .exe specifies that it is an executable file, .bas specifies it is BASIC program file, .PAS specifies that it is Pascal file, and so on. Therefore, extensions can be used for better understanding of filename.

In the same manner, as files are given names, disk are given internal names called volume label. It is an 11 character name given to a disk (be it FDD or HDD) for better description of its contents. External paper labels can also be put outside a floppy disk, on which descriptive names can be written to help one identify its contents.



Path is a sequence of directory names which give you the hierarchy to access a particular directory or file name.

The format of path is

Drive-letter:\directory [\directory…]

where first \ (backslash) refers to root directory and other (‘\’s) separate a directory name from the previous one.


The full name of a file or a directory is also called pathname.

For example:


Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: