DOS Directories and Files |
|
Scroll through the Directory Listing |
|
When we type the DIR command and press enter, the files begin to scroll vertically on our screen. If we have a lot of files it is difficult to read each one. By holding down the Control Key (CTRL) and the letter S at the same time, we are able to freeze the listing to view our files. When we are finished, press the spacebar for the list to continue. |
|
NOTE: |
We must return to the C:\> before entering our next command. |
|
|
|
|
|
|
|
|
DOS Directories and Files |
|
Pause a Directory Listing |
|
We can add a PAUSE command to our directory command which will allow us to view our directory one screen at a time. |
|
Directions: |
1. Type: dir/p and press Enter. |
|
2. The screen freezes after it fills the screen with the files that are listed first in the directory. |
|
3. Press the spacebar to continue listing you files. |
|
4. Continue to press the spacebar until you return back to the C:\> prompt. |
|
|
|
DOS Directories and Files |
|
View a Wide Listing of Files |
|
When we need to quickly view our files, we can add a /W to the directory command. This will display our files into five columns on the screen. |
|
Directions: |
1. Type: dir/w and press Enter. |
2. DOS will list only the name of you file and the file extension on the screen. |
|
NOTE: |
Use this command when you are not concerned with looking at the file size or the date it was created. |
|
|
|
|
|
DOS Directories and Files |
|
Recall a DOS Command |
|
The F3 function key can be used to recall the last DOS command we typed in. If we would like to retrieve a previously entered command, we can also press the up arrow key continuously until we reach the desired command we were looking for. |
|
NOTE: |
We can also type out each letter in our last command by using the right arrow key or theright cursor key. After we use the F3 key to recall a command, we can use the backspace key to edit any part of the command or add to our command. |
|
|
|
|
|
|
|
DOS Directories and Files |
|
Print a Directory Listing |
|
We can print a list of our files in our directory by instructing DOS to send the information to our printer. |
|
Directions: |
1. Type: dir>prn and press Enter. |
2. The > symbol stands for output. The PRN stands for printer. |
|
NOTE: |
We can print a wide listing of our files by typing dir/w>prn |
|
Laserjet printers and other sheetfeeder printers will not eject the page after the dir>prncommand. We must take the printer off-line and press the form feed button. Remember to press the on-line button when we are done in order to continue using the printer. |
|
|
|
DOS Directories and Files |
|
Check for a Single File |
|
Instead of using the directory command to look for one particular file, we can type the name of the file after the DIR command at the C:\> prompt. |
|
Directions: |
1. Make sure that we are at our C:\> prompt. |
2. Type: dir format.com (filename.extension) and press Enter. |
3. The screen will display a listing of the file or a file not found message. |
|
|
|
|
|
|
|
DOS Directories and Files |
|
List Files with the Same Extensions |
|
We can also use the wildcard character * to look for a group of files with the same extension. |
|
Directions: |
1. Type: dir *.bat and press Enter. |
2. All files with the .bat extension are listed. |
3. Press the F3 key. |
4. Backspace three times and replace the .bat extension with the .sys extension and pressreturn. |
5. All files with the .sys extension should now be listed. |
|
|
|
|
|
|
DOS Directories and Files |
|
Clear the Screen |
|
When the screen get full of information, we may want to clear it. |
To do this, type CLS at the C:\> prompt and press Enter. |
|
|
|
|
|
|
|
|
|
|
|
DOS Directories and Files |
|
Create a DOS File |
|
Directions: |
1. Type: copy con Quick.ltr and press Enter. |
2. Type this message in the following format: |
Aman eBIZ is giving the Dos tutorial. Good Job!
Enjoy |
|
3. Press the F6 function key (^Z) and press Enter. |
4. DOS gives you a message that 1 File(s) has been copied. |
5. Type: dir q* and press Enter. |
6. Now you can see the list of files beginning with the letter Q. |
|
NOTE: |
We can also use the COPY command to print a file by typing: copy quick.ltr prn and pressEnter. |
|
|
|
|
|
DOS Directories and Files |
|
Copy a File |
|
We can use the COPY command to copy one file to another. |
|
Directions: |
1. Type: copy quick.ltr quick2.ltr and press Enter. |
2. DOS will tell us one file has been copied. |
3. Type: dir q* and press Enter. |
4. We should have two files listed with different names. |
|
NOTE: |
Filenames cannot be more than eight characters in length. File extensions cannot be more than three characters in length. |
|
|
|
|
|
DOS Directories and Files |
|
Copy a File with a New Extension |
|
We can also use the COPY command to copy the file with a different filename extension. |
|
Directions: |
1. Type: copy quick.ltr quick.bac and press Enter. |
2. Type: dir q* and press Enter. |
3. Three files should be listed |
|
|
|
|
|
|
|
|
DOS Directories and Files |
|
Type a File with DOS |
|
If we need to check the contents of a particular file or any DOS file, we will need to use theTYPE command. |
|
Directions: |
1. Type: type quick2.ltr and press Enter. |
2. DOS prints the contents of the file. |
|
NOTE: |
Never use the TYPE command with files that have the .com, .exe, .sys, and .bas extensions. These are program files and will only display junk on the screen. |
|
|
|
|
|
DOS Directories and Files |
|
Rename a File |
|
The RENAME command lets us rename a previous file with a new name. |
|
Directions: |
1. Type: ren quick2.ltr sales.ltr and press Enter. |
2. Type: dir *.ltr and press Enter. |
3. DOS lists only two files that have the .ltr extension: quick.ltr and sales.ltr. |
|
|
|
|
|
|
|
|
DOS Directories and Files |
|
Rename a Group of Files |
|
With the wildcard character *, we can also use the RENAME command to change a group of files. |
|
Directions: |
1. Type: ren *.ltr *.bob and press Enter. |
2. Type: dir *.bob and press Enter. |
3. You should have two files listed with a .bob extension. |
4. Type: dir *.ltr and press Enter. |
5. There should be no files found with .ltr extensions. |
|
NOTE: |
We can also rename a group of files that have the same name but different extensions. Type the RENAME command then the filename followed by the dot and the wildcard, space and then type the new filename followed by a dot and the wildcard character. It will look like this: filename.* newfilename.* |
|
|
|
|
DOS Directories and Files |
|
Create a Subdirectory |
|
To create a subdirectory, we will need to use the MAKE DIRECTORY command, a.k.a. MD. The MD command is useful for organizing files on our hard drive. With subdirectories, we can create and store related files together. For example, one subdirectory could be used to store all word processing files and another for all spreadsheet files. |
|
Directions: |
1. Type: md \info and press Enter. |
2. Type: dir *. and press Enter. |
3. Notice the *. will list only the subdirectories. |
|
|
|
|
|
|
|
DOS Directories and Files |
|
Move to a Subdirectory |
|
Once we have created a subdirectory, to move to that directory, we will use the CHANGE DIRECTORY command, a.k.a. CD. |
|
Directions: |
1. Type: cd \info and press Enter. |
2. Type: cd and press Enter. |
3. The name of the directory is listed. |
|
|
|
|
|
|
|
DOS Directories and Files |
|
Set the DOS Prompt |
|
We can set or change the standard system prompt to display the name of the directory or subdirectory we are currently working in. |
|
Directions: |
1. Type: prompt $p $g and press Enter. |
2. The DOS prompt tells us that we are working in the C directory (drive) and in the Info subdirectory. |
3. Type: dir and press Enter. |
4. The single dot stands for the current directory. The double dots stand for the parent directory (root). The dots are often referred to as place markers. |
|
|
|
|
|
|
|
DOS Directories and Files |
|
Move to the Parent Directory |
|
DOS has a quick way to move from the current directory back to the parent directory. |
|
Directions: |
1. Type: cd.. and press Enter. |
2. We will return back to the C:\> prompt. |
|
|
|
|
|
|
|
|
|
|
DOS Directories and Files |
|
Copy a File into a Subdirectory |
|
The COPY command lets us copy files from one directory to another. |
|
Directions: |
1. Type: copy sales.bob \info and press Enter. |
2. Type: dir \info and press Enter. |
3. Notice that a copy of Sales.bob is copied into the subdirectory Info. The original file is also in the root directory. |
|
|
|
|
|
|
|
|
DOS Directories and Files |
|
Copy a Group of Files into a Subdirectory |
|
When copying a group of files from the root directory into a subdirectory, it is necessary to use the wildcard character * along with the COPY command. |
|
Directions: |
1. Type: copy quick.* \info and press Enter. |
2. DOS will list the files being copied. |
3. Type: dir \info and press Enter. |
4. Three files should be listed in the Info subdirectory. |
|
|
|
|
|
|
|
DOS Directories and Files |
|
List Files in a Subdirectory |
|
The CHANGE DIRECTORY, a.k.a. CD, command will let us list files in our subdirectory from our hard drive. |
|
Directions: |
1. Type: cd \info and press Enter. |
2. Type: dir and press Enter. |
3. All files in the Info subdirectory are listed. |
|
|
|
|
|
|
|
|
DOS Directories and Files |
|
Delete a Single File |
|
Periodically it is a good idea to delete files from the hard disk which are no longer needed or used. DOS makes it easy to remove these files with the DELETE command, a.k.a. DEL. |
|
Directions: |
1. Type: cd.. and press Enter. |
2. The prompt shows us that we are back in the root directory. |
3. Type: del sales.bob and press Enter. |
4. Type: dir Sales.bob and press Enter. |
5. Sales.bob is no longer listed because it has been deleted. |
|
|
|
|
|
|
|
DOS Directories and Files |
|
Delete a Group of Files |
|
By using the wildcard character * we can delete a group of files from our hard drive. |
|
Directions: |
1. Type: del quick.* and press Enter. |
2. Type: dir quick.* and press Enter. |
3. All Quick files have been deleted. |
|
|
|
|
|
|
|
|
Dos Directories and Files |
|
Delete all Files in a Subdirectory |
|
There are two rules we will need to follow before removing a subdirectory. |
All files in the subdirectory must be deleted. |
|
NOTE: |
Never type DEL *.* when we are in the root directory. It will destroy all DOS files that are necessary to boot and operate the computer. |
|
Directions: |
1. Type: cd \info and press Enter. |
2. Type: dir and press Enter. |
3. Three files should be listed. |
4. Type: del *.* and press Enter. |
5. DOS will ask you if you are sure? (Y/N) |
6. Type: Y and press Enter. |
|
Now that our subdirectory is empty, we can delete the subdirectory. |
|
|
|
Dos Directories and Files |
|
Remove a Subdirectory |
|
We cannot be in the subdirectory that we wish to remove. We will need to return to the root directory (C:\> prompt). |
|
Directions: |
1. Type: cd.. and press Enter. |
2. We should be back in the root directory. |
3. Type: rd \info and press Enter. |
4. Type: dir *. and press Enter. |
5. Notice that the Info subdirectory is no longer listed. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
No comments:
Post a Comment