codescracker


operating system os

OS Directory Operations



« Previous Tutorial Next Tutorial »


The allowed system calls for managing the directories exhibit more variation from system to system than system calls for the files.

Here are the list of some common samples taken from the UNIX system, shows what they are and how they work.

Here are the list of the common directory operations:

Let's describe briefly about all the above directory operations one by one.

Create

A directory is created. It is empty except for dot and dotdot, which are put there automatically by the system.

Delete

A directory is delete. Here, only those directory can be deleted which are empty.

Opendir

Directories can be read. But before reading any directory, it must be opened first.

Therefore to list all the files present in a directory, a listing program opens that required directory to read out the name of all files that this directory contains.

Closedir

Directory should be closed just to free up the internal table space when it has been read.

Readdir

This call returns the next entry in an open directory.

Rename

Directory can also be renamed just like the files.

Link

Linking is a technique that allows a file to appear in more than one directory.

Unlink

A directory entry is removed.


« Previous Tutorial Next Tutorial »




Tools
Calculator

Quick Links
Signup - Login - Give Online Test