Ch 6 Using DEL, MOVE, REN, and RD /S



Chapter 6

Using DEL, REN, MOVE, and RD /S

ANSWERS TO DISCUSSION QUESTIONS (p. 297)

1. Explain why you may want to eliminate files from a disk.

Erasing unwanted files saves disk space and decreases the number of files you have to manage. The more files and/or disks you have the harder it is to keep track of what disks have which files, which files are the ones you need, and which file is most current.

2. When you delete a file, the file is not actually removed from the disk. What really happens?

When a file is deleted, the OS frees the disk space in the FAT and marks the directory entry as deleted. But, the OS does not actually remove any data on the disk. When the next file is created, the OS sees that there is space available in the directory entry table and the FAT assigns the new file to that space. The old file is overwritten by the new file.

3. Give the syntax of the DEL command and explain each part of the syntax.

DEL [/P] [/S] [/F] [/Q] [/A[[:] attributes]] names

Note: names refers to [drive:][path] filename

The parameters, drive, and path are optional, but the filename is required. DEL is the command, drive represents the designated drive, path represents any subdirectory, and filename represents the name of the file you wish to delete. The /P parameter prompts you before each file is deleted. /F forces deletion of read-only files. /S deletes specified files from current directory and all subdirectories. /Q puts the command in quiet mode (not prompted to confirm deletion). /A deletes files based on specified attributes. Attributes abbreviated as follows; R – read-only, A – archive, s – system, h – hidden, ~ - prefix meaning “not”.

4. Explain the following g statement, with regards to the DEL command. The strength of wildcards is also a weakness.

Using wildcards with the DEL command allows you to erase a group of files with a one-line command. But, using wildcards can be dangerous because you can eliminate a group of files very quickly and if you are not careful you could delete files you want to keep. If you do not realize your error immediately, it may not be possible to undelete the files that were deleted.

5. When deleting files, why should you key in DIR with global file specifications first?

By keying in DIR with global file specifications the screen will display all the files that have been selected to be deleted, and you can make sure that you are not going to delete files, which you want to keep.

6. Explain the purpose and function of the /P parameter with the DEL command. The /S?

The /P parameter which became available in DOS 4.0, prompts you to confirm whether or not you wish to delete a file. It is useful when using wildcards and minimizes risk of accidental file deletions.

/S parameter transverses the directory tree so you do not need to delete files individually throughout your disk structure.

7. Why would you want to change the name of a file?

You may want to change the name of a file because....

1. the contents of the file have changed and the old name no longer applies.

2. you want to use the name for something else.

3. you think of a better name.

4. you named the file incorrectly.

8. Explain the purpose and function of the RENAME or REN command.

The RENAME or REN command can be used to change the names of files.

9. Give the syntax of the REN command and explain each part of the syntax.

REN [drive:][path] [directoryname1 | filename1] [directoryname2 | filename2]

The drive and path are optional in the first set of parameters and not allowed in the second set of parameters. REN is the command, drive represents the designated drive, and path represents any subdirectory. Filename1 and filename2 refer to same file. Filename1 will be changed to filename2.

10. What is the difference between the REN and RENAME commands?

The REN and RENAME commands are identical functions.

11. What is the difference between the RENAME and COPY commands?

The RENAME command changes the name of an existing file but leaves it in the same directory. The COPY command gives you two files with the same contents, one with the old name and one with the new name. With the COPY command the new file can be copied in any directory or on any disk.

12. If you are using the REN command and get the message, “A duplicate file name exists, or the file name cannot be found,” what could it mean?

If you get this message, it means that the name you tried to give the file is already in use by another file. If you get the message ”file not found”, it means that the file you told REN to rename does not exist on the specified drive and directory.

13. What is the function and purpose of the MOVE command?

The MOVE command can be used to rename a directory. It can also be used to move files and subdirectories from one location to another.

14. Give the syntax of the MOVE command and explain each part of the syntax.

To move one or more files:

MOVE [/Y | /-Y] [drive:][path]filename1 [,...] destination

To rename a directory:

MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

• [drive:][path]filename1 – location and name of file to be moved.

Destination – new location of file. If you are moving only one file - include a file name if you want to rename file when you move it.

• [drive:][path]dirname1 – specifies directory you want renamed.

o dirname2 – specifies new name of directory.

• /Y – suppresses prompting to confirm creation of a directory or overwriting of destination.

• /-Y – Causes prompting to confirm creation of a directory or overwriting of destination.

15. Compare and contrast MOVE and COPY.

MOVE can rename subdirectories, which COPY cannot do.

MOVE copies a file and then deletes the original while COPY makes a copy of the file and then leaves the original file intact.

16. What is the difference between the MOVE and the REN commands?

Both MOVE and REN can rename files and subdirectories.

REN renames files and then leaves them in the same subdirectory.

MOVE can move files to other drives and directories. If a file or subdirectory is moved one at a time, it is possible to rename the file and move it at the same time.

17. Compare and contrast the RD /S command with the RD command without the /S parameter.

Both commands will remove directories.

RD removes only one directory at a time and the directory must be empty of all files. The command works from bottom up and is a two-step process. First, must delete all files from the directory and then delete the directory.

RD /S deletes from top down and with one command can remove an entire structure (directories with files within directories). It is a powerful but dangerous command.

18. What process could you use to back up a specific file?

Use the COPY command to back up a specific file.

19. What process could you use to back up a subdirectory?

To backup small subdirectories you could use COPY *.* destination. To backup larger subdirectories or entire hard drives, you need to use programs like MSBACKUP or other commercial backup programs.

20. Why would you not copy all the files from the hard disk to a floppy disk with the DISKCOPY command?

Backing up a hard disk is a special circumstance using special operating commands and procedures. In practical terms the contents will not fit on one floppy disk as there is much more information on a hard disk. But more important, to use DISKCOPY you must have identical media types and a hard disk and a floppy are not identical media.

21. Why would you not copy all the files from a hard disk to a floppy disk with the COPY command?

You cannot and must not copy all the files from a hard disk to a floppy disk with the COPY command. COPY is used to back up files from floppy disks to floppy disks or specific files in specific directories on the hard disk to a floppy disk. COPY can be used if you have two removable drives because if you are using two disk drives, COPY does not require identical disk media types.

However, practically, there would not be enough room on a floppy to copy all the files from a hard disk to one floppy disk as hard drives contain much more information than a floppy disk could contain.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download