2. Recap
In the last class, you have learnt
• Single and two level directories
• Tree-structured directories
http://raj-os.blogspot.in/ 2
3. • HOME PREVIOUS TOPIC NEXT
• PREVIOUS QUESTION PAPERS FOR
OS
• CPP TUTORIALS
http://raj-os.blogspot.in/ 3
4. Objectives
On completion of this period, you would be able to:
• Understand how deletion of a directory from a tree
structured directory is handled
• Advantages and limitations of tree-structured
directories
• Understand acyclic-graph directory structure
http://raj-os.blogspot.in/ 4
5. Deleting a Directory
• Two cases arise
• The directory to be deleted is empty
• The directory to be deleted is non empty
http://raj-os.blogspot.in/ 5
6. Deleting an Empty Directory
• Delete its entry from its containing directory
http://raj-os.blogspot.in/ 6
7. Deleting a Non Empty Directory
Two ways to handle the situation
1. Do not delete unless the directory is empty
2. Request confirmation from the user
whether the non empty directory is to be
deleted along with the directory’s files and
subdirectories
http://raj-os.blogspot.in/ 7
8. The First Approach is used by MS-DOS
• If a user wants to delete a non empty directory, he must
first delete all the files in that directory
• If there are any subdirectories, same procedure must be
recursively applied
• Involves a substantial amount of work
http://raj-os.blogspot.in/ 8
9. The Second Approach is used by Unix
• Provide an option to the user whether that
directory’s files and subdirectories are also to be
deleted
• More convenient than the first approach, but more
dangerous if command to delete is issued in error
http://raj-os.blogspot.in/ 9