iSelfSchooling.com  Since 1999     References  |  Search more  | Oracle Syntax  | Free Online Oracle Training

    Home      .Services     Login       Start Learning     Certification      .                 .Share your BELIEF(s)...

 

. Online Accounting        .Copyright & User Agreement   |
    .Vision      .Biography     .Acknowledgement

.Contact Us      .Comments/Suggestions       Email2aFriend    |

 

File Interaction Commands 

Introduction to file interaction commands 

Key Topics 

Introduction to DOS 

DOS Filing System 

DIR Command 

Command Options 

Changing Directories 

DOS Editor 

Make Directory Command 

Copy Command 

The Wild Card 

Deleting a File 

Renaming a file 

Type Command 

Removing a Directory 

Tree Command 

Deltree Command 

XCOPY Command 

ATTRIB Command 

Questions 

File Interaction Commands

Introduction to file interaction commands

  • The commands used in this module  are required to maneuver around the DOS  operating system  and to manipulate files  and folders

  • These commands can also be used in a DOS  comparable environment such the DOS prompt, windows command prompt , windows startup  disk etc.

Key Topics

  • Learn basic Dos commands

  • DIR , CD , MD

  • DOS  File system

  • COPY  single and multiple files

  • DEL  and REN  and TYPE  commands

  • RD  and DELTREE  commands

  • XCOPY  command

  • ATTRIB  command

Introduction to DOS

DOS  is a command-based operating system . A command must be typed with the correct spelling and syntax before it can function. This operating system will present you with errors  if mistakes are make which will need to be resolved. DOS is not a very informative operating system when errors are made which means that DOS becomes progressively easy to use with experience. The reason DOS is being used today is because of its simplicity and reduced memory  and storage space requirements.

DOS  Filing  System

The DOS  Filing  system is an important component of DOS. You can compare the DOS filing system with a typical filing cabinet.  It contains an organized  hierarchy  of files  and folders . All files and folders must be organized in a logical manner, which makes the searching  process intuitive. The root directory  can contain a maximum of 512 files. The root directory can also contain folders and sub-folders.  

DIR  Command

The DIR  command can be used to view what is contained in the drive.

Command Options

All DOS  commands have certain options associated with them that can be activated by using the forward slash /. These options of commands can be referred to as switch options. The syntax of the DOS commands is as follows (Command / option) e.g. DIR \w. All commands have there own set of switches which apply to that particular command alone.

Changing Directories

Maneuvering around the system directory  system is easy in DOS . In order to change directory you can use the CD  command. CD (directory name) will change your current location to a subdirectory  defined e.g. (CD Windows). In order to return to a higher level directory you must type the CD.. command. You can use the CD\ command to return directly to the root directory from any sub-directory.

DOS  Editor

The DOS  editor is a program called EDIT inside DOS. Using this editor we can generate a new DOS file, and edit an existing DOS file. We can type the file contents, use the Alt-F key to use file and then from the menu option choose the save option. We must type the file name and extension in the same screen while ensuring that the file name does not exceed 8 characters and the file extension does not exceed 3 characters.

Make Directory Command

In order to make a directory  you use the command MD . E.g. MD Colors.

Copy  Command

A path  can be thought of as an addressing scheme. When we use the path c:\windows \Drivers\file 1 means that file1 is contained in the drivers  folder which is contained in the windows folder which is in turn contained in the C: drive. When copying files  you must use the source path and the destination path of the files being copied.

 

The Wild Card

You can perform a collective copy by using the * which is the wild card. The * can be used when you need to make a selection based on a criterion of a file. In the above example you can copy all the files  with a TXT extension. You can also copy all the text files that begin with the B character.

Deleting a File

You can use the del command to remove a file from the directory . Just type DEL  (filename). It is important to note that the file will be deleted within DOS  and not backup of the file deleted is available unlike Windows that uses the Recycling bin. You could opt to try and recover  the file deleted by using the UNDELETE command which will only prove to successful if the file has not been overwritten. It is therefore advisable to use the undelete command as soon as possible if you need to recover a file of interest.

Renaming a file

You can rename a file by typing the above command. The contents of the file will remain unchanged but the file name will change.

Type Command

In order to view the contents of a file one must ether use the EDIT command or use the TYPE  command. The EDIT command allows us to view and change the file of interest.

Removing a Directory

To remove a directory  you can use the RD  command. Just type RD (directory name).

The directory  that needs to be removed must be empty of files  and directories.

Tree Command

 

The TREE  command can be used to view the contents of a hard drive  in a tree structure. You can view the files  within this tree as well as the folders  by using the TREE /F command.

Deltree Command

The DELTREE  can be used to remove a structure which contains files , directories and directories containing files.

XCOPY  Command

The XCOPY  command can be used to duplicate a structure, which contains files  and sub-directories. The system will respond by asking you to select to copy the structure into a file or directory .

ATTRIB  Command

Within DOS  all files  are stored in its FAT filing system. FAT or File Allocation Table allows all file to have up to four different attributes. The four attributes of DOS are S=system, A=Archive , R=Read  only, H=Hidden.

You can add attributes to files  and view all current file attributes by using the ATTRIB  command. You can add an attribute  by using the + sign and remove an attribute by using a – sign.

The Archive  attribute  is fairly automatic and is added to new files  by default. Whenever new files are generated or a file is edited the archive attribute is automatically added to files. Whenever files undergo a backup process the archive attribute is removed from the files.

The R attribute  will make a file a read  only  file. The files  which have the read only attribute cannot be changed or deleted. The system will produce the access denied response if an attempt is made to delete or change a file.

 

The Hidden attribute  will hide a file and make the file invisible to normal DOS  commands. The only way you can view a file is by using the ATTRIB  command.

The system S attribute  is automatic and assigned to the operating system  files  that is explained later in detail.

 

Questions

 

  1. What file information  is provided by typing the Dir command?(Choose all that apply)

    1. File name

    2. File extension

    3. File property

    4. File creation date

    5. File attribute

  2. What file information  is provided by typing the Dir command?(Choose all that apply)

    1. File subdirectory

    2. File extension

    3. File size

    4. Directory name

    5. File backup date

  3. Which of the following are possible options of the CD  command? (Choose all that apply)

    1. CD ..

    2. CD \

    3. CD /

    4. CD  Directory name

    5. CD  *.*

  4. What does the MD  command stand for?

    1. Make drive

    2. Make directory

    3. Move  directory

    4. Mouse device

    5. Move  directory

  5. What is the syntax of the COPY  command for copying file1.txt to folder1?

    1. Copy  file1.txt folder1

    2. Copy  folder1 file1.txt

    3. Copy  folder1 *.*

    4. Copy  file1.txt *.*

    5. Copy  file1.txt d:\folder1

  6. How do you delete all files  in folder1? (Choose all that apply)

    1. Del *.*

    2. CD  folder1à Del *.*

    3. Del folder1

    4. RD  Folder1

    5. Deltree Folder1

  7. How can you remove folder1? (Choose all that apply)

    1. Del *.*

    2. CD  folder1à Del *.*

    3. Del folder1

    4. RD  Folder1

    5. Deltree Folder1

  8. How can you view the contents of file1.txt? (Choose all that apply)

    1. Type file1.txt

    2. View file1.txt

    3. Read  file1.txt

    4. Edit file1.txt

    5. Attrib file1.txt

  9. What does the /s/e mean in the XCOPY  command? (Choose all that apply)

    1. /s means subdirectory

    2. /s means system files

    3. /e means error files

    4. /e means empty directory

    5. /s/e means all system error files

  10. What does the ATTRIB  command do? (Choose all that apply)

    1. View system files

    2. View all file attributes

    3. Change  file attributes

    4. Change  directory  attributes

    5. Remove current file attributes

  11. What are the attributes that can be changed with the ATTRIB  command? (Choose all that apply)

    1. Read  only

    2. Hidden

    3. Secure

    4. Compress

    5. System

    6. Archive

  12. What symbols are used to add and remove file attributes? (Choose all that apply)

    1. ^

    2. +

    3. ?

    4. /

    5. *

Answers

  1. A,B,D

  2. B,C,D

  3. A,B.D

  4. A

  5. A

  6. B,C,E

  7. D,E

  8. A,D

  9. A,D

  10. B,C,E

  11. A,B,E,F

  12. B,E

 

Google
 
Web web site