Friday, 22 November 2024

File Structure in DOS

 

File Structure in DOS

The file structure in DOS consists of the following key elements:


1. Root Directory

  • The root directory is the topmost level in the DOS file structure.
  • It is represented by a drive letter followed by a colon (C:\, D:\, etc.).
  • All other directories and files are organized under the root directory.

2. Directories and Subdirectories

  • Directories are folders used to organize files into manageable groups.
  • Subdirectories are directories within other directories, forming a hierarchical structure.
  • Example:

makefile

C:\Documents

C:\Documents\Projects

C:\Documents\Photos

  • The backslash (\) is used to separate directories and subdirectories.

3. Files

  • Files are the basic storage units in DOS, containing data or programs.
  • A file in DOS has two main parts:
    • Filename: Up to 8 characters.
    • Extension: Up to 3 characters, separated by a dot (.), used to identify the file type (e.g., .TXT, .EXE, .BAT).
    • Example: MYFILE.TXT

4. File Naming Conventions

  • DOS follows the 8.3 filename format, meaning filenames can have:
    • Up to 8 characters in the name.
    • Up to 3 characters in the extension.
  • Rules:
    • Filenames cannot contain spaces or special characters like /, \, :, *, ?, ", <, >, |.
    • Filenames are case-insensitive (e.g., MYFILE.TXT is the same as myfile.txt).

5. Pathnames

  • A pathname specifies the location of a file or directory in the file structure.
  • It can be:
    • Absolute Path: Specifies the complete path from the root directory.
      • Example: C:\Documents\Projects\Report.doc
    • Relative Path: Specifies the path relative to the current directory.
      • Example: Projects\Report.doc

6. Special DOS Directories

  • Current Directory: The directory you are currently working in. Use the CD command to change it.
  • Parent Directory: The directory above the current directory. Represented by ...
  • Root Directory: The topmost directory. Represented by \.

7. Common DOS Commands for File Structure

  • DIR: Displays the list of files and directories in the current directory.
    • Example: DIR C:\
  • CD (Change Directory): Changes the current directory.
    • Example: CD Documents
  • MD (Make Directory): Creates a new directory.
    • Example: MD Projects
  • RD (Remove Directory): Deletes a directory.
    • Example: RD Projects
  • COPY: Copies files.
    • Example: COPY source.txt destination.txt
  • DEL: Deletes files.
    • Example: DEL myfile.txt

Hierarchy Example

C:\

── Documents

   ── Projects

      ── Report.doc

      └── Budget.xlsx

   └── Photos

       └── Vacation.jpg

── Programs

   ── App.exe

   └── Utility.bat

└── Autoexec.bat

In this example:

  • The root directory is C:\.
  • Documents and Programs are subdirectories of the root.
  • Projects and Photos are subdirectories of Documents.

 

No comments:

Post a Comment

Control Panel in Windows OS

  Control Panel in Windows OS: The Control Panel in Windows is a centralized hub that provides users with tools and options to configure ...