Topic : Working with Directories using Command prompt:



Working with directories using command prompt: InfoBrother

Introduction:

In Computing, a directory also known as a Folder or Drawers is a file system cataloging structure which contains references to other computer files, and possibly other directories.

Files are organized by storing related files in the same directory. A directory contained inside another directory is called a Subdirectory. We use the terms "Parent" for Directory and "Child" for subdirectory to describe the relationship between a directory and subdirectory in which it is cataloged. The top-most directory in such a filesystem, which does not have a parent of its own is known as root directory.




»

Quick Summary: We are going to Learn -



1

Basic of Command Prompt:


Working with directories using command prompt: InfoBrother

    When we open the command prompt, a message similar to the above picture appears.
    1 » The first line shows the Window version that we have installed.
    2 » The second line shows the copyright statement.
    3 » The third line is Blank.
    4 » The fourth line is the prompt, or command prompt. It shows our current location in the system - Root » Directory » Sub-Directory. A blinking prompt follows and this is where you can begin entering commands.



2

Working with Current Directories:


Working with directories using command prompt: InfoBrother

The current directory, also known as the working directory, is where we are. In window environment, this is equivalent to having a window open and viewing the files. To know the current directory, type chdir or cd after the prompt and press enter. both command will display the current working directory.




3

Listing the Current Directories:


Working with directories using command prompt: InfoBrother

To see what is contained in the current directory, we can use a directory list command dir with the following additional options.


OptionsDescription
/aDisplays files with specified attributes.
/t:wIndicates the output should display the time and files were last written.
/sList recursively through all directories and files within the current directory.
/pIndicates that the output should display one page at a time.


There are many more option to use with dir command. type Help dir in command prompt to get the complete list of options.




4

Changing Directories from current to other:


Working with directories using command prompt: InfoBrother

Now, we can know that what is the current directory and we may want to navigate to a different directory. To change the current directory, we use cd command as shown above in picture. using cd command, we are in Desktop directory, just like we double clicked on the Desktop folder. We can get a list of all the documents in the directory using dir command




5

Creating New Directories:


Working with directories using command prompt: InfoBrother

We can use the command prompt to create new directories in our window just like we create a new folder. The words directory and folder are often used interchangeably to identify organizational structures in a file system. We can create new directories to keep files or other directories in it. we use mkdir command along with the directory name to create new directory within the current working directory. consider the following examples:
1 » Create Directory within current working directory.


mkdir folder1

Above command will create New directory named folder1 within current working directory. Be sure you know where you are currently.

Create Directory at specific location.


mkdir G:\Directory\Sub-Directory-2\folder2

Above command will create New directory named folder2 at G-drive » Directory » Sub-Directory-2

.



6

Delete Directories:


Working with directories using command prompt: InfoBrother

We can use command prompt to Delete directories in our window just like we delete any folder. we use rmdir command along with the directory name to delete any directory. consider the following examples:
1 » Delete Directory from current working directory.


rmdir folder1

Above command will delete directory named folder1 from current working directory. Be sure you know where you are currently.

Delete Directory from specific location.


rmdir G:\Directory\Sub-Directory-2\folder2

Above command will delete directory named folder2 from location G-drive » Directory » Sub-Directory-2

.

TIP: It is always safer to be very specific when creating or deleting the directory. We prefer to use the second example to create or delete the directory because it is less likely to cause problems if we mistype something or if our current working directory is not that what we want.





You like it? Other May like it too:

PLEASE SHARE






I Tried my Best to Provide you complete Information regarding this topic in very easy and conceptual way. but still if you have any Problem to understand this topic, or do you have any Questions, Feel Free to Ask Question. i'll do my best to Provide you what you need.

Sardar Omar.
InfoBrother