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



Chapter 6

Using DEL, REN, MOVE, and RD /S

LEARNING OBJECTIVES

1. Explain why it is necessary to eliminate files from a disk.

2. Explain when and how to use wildcards with the DEL command.

3. Explain the use of the /P parameter with the DEL command.

4. Explain the purpose and function of the RENAME/REN command.

5. Explain the purpose and function of the MOVE command.

6. Explain the purpose and function of the RD /S command.

7. Explain the importance of backing up data.

STUDENT OUTCOMES

1. Use the DEL command to eliminate files on disks and in directories.

2. Use wildcards appropriately with the DEL command.

3. Use parameters with the DEL command.

4. Use the RENAME/REN command to change the names of file and subdirectories.

5. Use the RENAME/REN command with wildcards to change the names of files and subdirectories.

6. Use the MOVE command to move files and subdirectories.

7. Use the RD command without parameters to delete empty directories.

8. Use the RD command with parameters to delete directories with files and other directories.

9. Back up a data disk using the DISKCOPY command.

10. Back up files using the COPY command.

CHAPTER SUMMARY

1. DEL eliminates files.

2. Deleting files helps you manage your disks and directories.

3. The syntax for the DEL command is: DEL names

4. Wildcards can be used with DEL.

5. DEL does not eliminate the data on the disk, only the entry in the directory table.

6. Once a file has been deleted, it cannot be recovered except with special utility programs.

7. Before you use wildcards with DEL, it is wise to use the DIR command to see what is going to be erased.

8. The /P parameter prompts you to confirm whether or not you wish to delete a file, and the /S parameter allows you to delete files in the directory hierarchy.

9. You can change the names of files or directories with the RENAME or REN command.

10. The syntax for renaming is:

RENAME [drive:] [path] [directoryname1 | filename1]

[directoryname2 | filename2]

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

[directoryname2 | filename2]

11. Renaming can be done only on one drive or directory. RENAME does not move files.

12. Renaming changes only file names, not contents of files.

13. With the REN command, you use the path only with the original file name and do not repeat it with the new file name.

14. Wildcards can be used with the REN command.

15. Before you use wildcards with the REN command, it is wise to use the DIR command to see what files are going to be affected by renaming.

16. Once a file is renamed, it cannot be found under its old name.

17. The MOVE command can be used either to change the name of a subdirectory or to move files from one location to another. When you use MOVE, two steps are taken: the files are copied to the new location and deleted from the old location.

18. You may remove directories with either RD or RD /S. With RD alone, you must remove files first and then any directories. RD /S does it all in one command.

19. It is wise to make backup copies of data files so that if something happens, you have another source of data.

20. You can back up a floppy disk with the DISKCOPY command, or you can back up files on your disk using the COPY command. The wildcard *.* allows you to back up all the files in a directory.

KEY TERMS

|archival backup |copy-protected |Disaster and Recovery Plan |

|archival data | | |

LECTURE N0TES

|CHAPTER OUTLINE |

|Chapter Overview |

|Will continue to work with internal commands that help manage and manipulate files. |

|Will focus on the following commands: DEL, REN, MOVE, and RD /S. |

|Why and how to back up specific files, or an entire disk so as to not lose important data will be discussed. |

| |

|ELIMINATING FILES WITH THE DEL COMMAND |

|Eliminating Files with the DEL Command |

|Number of files grows rapidly. |

|Keep only files you need on disk. |

|Erasing unwanted files saves disk space and confusion. |

|Use DEL to erase unwanted files. |

|Internal command. |

|Always resident in memory. |

|File gone forever once is pressed after DEL command. |

|OS does NOT ask for confirmation, only follows your instructions. |

|File deleted at command line. |

|Cannot be recovered except by certain special utility programs. |

|Recovery not necessarily complete. |

|Process of deleting files. |

|First character of file name replaced. |

|Marks all clusters in FAT where file once was. |

|File is not actually erased. |

|When next file created, OS sees space available in directory entry table. |

|FAT assigns new file to space. |

|Old file overwritten by new file. |

|Process similar when using NTFS file system. |

|Instead of FAT, file’s MFT entry, directory entry, and data clusters are marked as available. |

|File’s data remains until clusters get recycled to store other files. |

|Special utility program like Norton Utilities can sometimes help recover deleted file if you realize immediately that file is erased. |

|MS-DOS 5.0-6.22: |

|UNDELETE supplied with OS to recover deleted files. |

|Once file overwritten with new data old data unrecoverable. |

|UNDELETE – not supported by WXP or W2K Professional. |

|Use DEL – have removed files. |

|Deleting file from hard drive using My Computer or Windows Explorer (Windows 95/98) can recover file as file goes to Recycle Bin. |

|Files not recoverable if: |

|Delete files from removable disk, such as a zip drive. |

|Delete files from a floppy disk. |

|Deleted from MS-DOS command line. |

|DEL syntax with /P: |

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

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

| |

|ACTIVITY—USING THE DEL COMMAND |

|Using the DEL Command |

|Use editing keys to correct typing errors. |

|DATA Disk is in Drive A. |

|C:\> displayed as default drive & directory. |

|Activity steps. |

|Key in: |

|A: |

|COPY C:\WUGXP\*.DOS *.AAA |

|DIR *.AAA |

|DIR WILDONE.AAA |

|DEL WILDONE.AAA |

|DIR WILDONE.AAA |

|DEL NOFILE.XXX then DEL |

|Activity completed. |

| |

|DELETING MULTIPLE FILES |

|Deleting Multiple Files |

|To delete multiple files with DEL – list files you want deleted after the DEL command, separated by a space. |

| |

|ACTIVITY—USING DEL WITH MULTIPLE PARAMETERS |

|Using DEL with Multiple Parameters |

|Activity steps. |

|Key in: |

|COPY C:\WUGXP\*.DOS *.BBB |

|DIR *.BBB |

|DIR WILDONE.BBB WILDTWO.BBB WILDTRH.BBB |

|DEL WILDONE.BBB WILDTWO.BBB WILDTHR.BBB |

|DIR *.BBB |

|Activity competed. |

| |

|DELETING FILES ON OTHER DRIVES AND DIRECTORIES |

|Deleting Files on Other Drives and Directories |

|Use DEL to eliminate files on other drives and subdirectories. |

|Syntax remains - DEL names. |

|Names refers to designated drives, subdirectories, and names of files you wish to delete. |

|Review DEL syntax. |

|Notice DEL and names are not in brackets – so they are required parts of the command. |

|Go over importance of sequence. |

|Incorrect: A:\>DEL GONE.FIL B: |

|Correct: A:\DEL B: GONE.FIL |

| |

|ACTIVITY—USING THE DEL COMMAND WITH INDIVIDUAL FILES |

|Using the DEL Command with Individual Files |

|DATA disk in Drive A, A:\ displayed. |

|Activity steps. |

|Key in: |

|MD TRIP |

|COPY C:\WUGXP\*.99 TRIP |

|COPY C:\WUGXP\*.JAZ TRIP |

|DIR TRIP\JUP.99 |

|DEL TRIP\JUP.99 |

|DIR TRIP\JUP.99 |

|CD /D C:\WUGXP |

|COPY HELLO.TXT A:\ |

|DIR HELLO.TXT |

|DIR A:\HELLO.TXT |

|DEL A:\HELLO.TXT |

|DIR HELLO.TXT |

|DIR A:\HELLO.TXT |

|DIR A:\TRIP\BLUE.JAZ |

|DEL A:\TRIP\BLUE.JAZ |

|DIR A:\TRIP\BLUE.JAZ |

|CD \ THEN A: |

|Activity completed. |

| |

|USING WILDCARDS WITH THE DEL COMMAND |

|Using Wildcards with the DEL Command |

|Wildcards used to delete a lot of files at once. |

|Can erase group of files with one-line command. |

|BE CAREFUL! Can accidentally delete files you need. |

|Deleting files in My Computer. |

|Select each file to be deleted – one at a time. |

|Takes longer to delete group of files. |

| |

|ACTIVITY—USING THE DEL COMMAND |

|Using the DEL Command |

|DATA disk in Drive A, A:\> displayed. |

|.TMP files on root of the DATA disk, if not, copy from \WUGXP subdirectory. |

|Activity steps. |

|Key in: |

|DIR *.TMP |

|DEL *.TMP |

|DIR *.TMP |

|DIR TRIP\*.99 |

|DEL TRIP\*.99 |

|DIR TRIP\*.99 |

|Activity completed. |

| |

|THE /P AND /S PARAMETERS WITH THE DEL COMMAND |

|The /P and /S Parameters with the DEL Command |

|Parameters available in DOS 4.0 and above. |

|/P is optional fixed parameter. |

|Allows verification prior to each file deletion. |

|Useful when using wildcards. |

|Minimizes risk of accidental file deletions. |

|Syntax: DEL /P] [/S] names |

|/S is optional fixed parameter. |

|Traverses directory tree – |

|Do not delete files individually throughout your disk structure. |

|Other parameters added to W2000 Professional. |

|/F – force deletion of read-only files. |

|/A – delete file based on certain attributes. |

|/Q – do not ask for confirmation of a deletion. |

| |

|ACTIVITY—USING /P AND /S WITH THE DEL COMMAND |

|Using /P and /S with the DEL Command |

|DATA disk in Drive A, A:\> displayed. |

|Activity steps. |

|Key in: |

|COPY C:\WUGXP\*.99 |

|MD TRIP\CHINA |

|COPY *.99 TRIP |

|COPY *.99 TRIP\CHINA |

|DIR TRIP TRIP\CHINA |

|DEL TRIP\*.99 /P |

|N |

|Y (if VEN.99 displayed) |

|N (if JUP.99 displayed) |

|N (if JUP.99 displayed) |

|Y (if MER.99 displayed) |

|Y (if MER.99 or VEN.99 displayed) |

|DIR TRIP |

|DEL TRIP\*.99 /P /S |

|N (twice) |

|Y till no more prompts |

|RD TRIP\CHINA |

|Activity completed. |

| |

|CHANGING FILE NAMES |

|Changing File Names |

|Why rename a file? |

|File contents changed - old name no longer applies. |

|Want name for another file. |

|Think of a better name. |

|File named incorrectly. |

|Use COPY command. |

|Change name of file by copying file to a different name. |

|Created new file with same contents under a different name. |

|End up with file and a copy of file with a new name. |

|RENAME command. |

|Internal command. |

|Changes name of file – not the contents. |

|Not creating another copy of file with a new name. |

|End up with same file but with new name. |

|File does not move from one directory to another. |

|Syntax: |

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

|or |

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

|Cannot specify new drive of path for filename2. |

|Filename1 and filename2 refer to same file. |

|Filename1 will be changed to filename2. |

|Renaming files in My Computer/ Windows Explorer two-step process. |

|Select file. |

|Rename it. |

|At command line it is a one-step process to rename file. |

| |

|ACTIVITY—USING THE REN COMMAND TO RENAME FILES |

|Using the REN Command to Rename Files |

|DATA disk is in Drive A, A:\> displayed. |

|Activity steps. |

|Key in: |

|COPY C:\WUGXP\MEDIA\TV |

|TYPE |

|REN |

|DIR |

|DIR |

|TYPE |

|DIR TRIP\GREEN.JAZ |

|REN TRIP\GREEN.JAZ TRIP\RED.JAZ |

|REN TRIP\GREEN.JAZ RED.JAZ |

|DIR TRIP\*.JAZ |

|Activity completed. |

| |

| |

|CHANGING THE NAMES OF SUBDIRECTORIES |

|Changing the Names of Subdirectories |

|Beginning with W95, REN command also renames subdirectories. |

|Previously used MOVE command to rename subdirectories. |

| |

|ACTIVITY—USING THE REN COMMAND TO RENAME SUBDIRECTORIES |

|Using REN Command to Rename Subdirectories |

|DATA disk in Drive A and A:\> displayed. |

|Activity steps. |

|Key in: |

|MD PAGE ONE then DIR P*.* |

|REN PAGEONE PAGETWO |

|DIR P*.* |

|MD PAGETWO\DIRONE |

|DIR PAGETWO |

|REN PAGETWO\DIRONE DIRTWO |

|DIR PAGETWO |

|RD PAGETWO /S |

|Y then DIR P*.* |

|Activity completed. |

| |

|USING REN WITH WILDCARDS |

|Using REN with Wildcards |

|Wildcards used to rename multiple files that have a common element at one time. |

|Before using RENAME or REN use DIR with wildcards. |

|See what files will be renamed. |

|Don’t want to rename file accidentally. |

|Once file renamed – can’t find it under old name. |

| |

|ACTIVITY—USING REN WITH WILDCARDS |

|Using REN with Wildcards |

|DATA disk in Drive A and A:\> displayed. |

|DATA disk has files with file extension .NEW – if not copy from \WUXP to DATA disk. |

|Activity steps. |

|Key in: |

|DIR ???.NEW |

|REN ???.NEW *.BUD |

|DIR ???.NEW *.BUD |

|COPY *.BUD TRIP |

|REN TRIP\*.BUD *.PEN |

|DIR TRIP\*.BUD then DIR TRIP\*.PEN |

|Activity completed. |

| |

|USING RENAME ON DIFFERENT DRIVES AND DIRECTORIES |

|Using Rename on Different Drives and Directories |

|REN |

|Internal command. |

|Renames file and leaves it where it found it. |

|Used for any file on any drive or directory. |

|To rename a file on another disk must specify drive letter and directory. |

|Cannot be used to move a file from one disk to another or from one directory to another. |

|COPY vs. REN command. |

|COPY command. |

|Copy a file from one disk to another or one directory to another. |

|End up with two identical files in different locations. |

|REN command. |

|Cannot: |

|Move a file from one location to another. |

|Copy a file. |

|Changes names of: |

|Files in one directory or disk at a time. |

|Existing file in specific location. |

| |

|ACTIVITY—USING RENAME ON DIFFERENT DRIVES |

|Use RENAME on Different Drives |

|DATA disk in Drive A and A: \> displayed. |

|Activity steps. |

|Key in: |

|CD /D C:\WUGXP |

|DIR ASTRO.TXT |

|COPY ASTRO.TXT A:\ |

|DIR A:\ASTRO.TXT |

|TYPE A:\ASTRO.TXT |

|REN A:\ASTRO.TXT A:\AST.TST |

|REN A:\ASTRO.TXT AST.TST |

|DIR ASTRO.TXT |

|DIR A:\ASTRO.TXT |

|DIR A:\AST.TST |

|TYPE A:\AST.TST |

|DIR A:\TRIP\*.PEN |

|REN A:\TRIP\*.PEN *.INK |

|DIR A:\TRIP\*.PEN |

|DIR A:\TRIP\*.INK |

|CD \ then A: |

|Activity completed. |

| |

|MOVING FILES AND RENAMING DIRECTORIES |

|Moving Files and Renaming Directories |

|MOVE and REN can both be used to rename files. |

|REN renames but does not move files. |

|To move have to COPY files from old location to new and then delete old files. |

|MOVE, introduced in DOS 6.0, will let you rename directory and move files. |

|Move group of files - cannot change file names. |

|Move individual file - can change name. |

|Review syntax of MOVE. |

|MOVE command can be used to move files and directories from one directory to another, and also from one drive to another. |

|Useful in maintaining hard disk. |

| |

|ACTIVITY—MOVING FILES AND RENAMING DIRECTORIES |

|Moving Files and Renaming Directories |

|DATA disk is in Drive A, A:\> displayed. |

|Activity steps. |

|Key in: |

|MD FILES |

|COPY *.99 FILES\*.FIL |

|MD FILES\ROOM |

|COPY GALAXY.NEW FILES |

|DIR FILES |

|MOVE FILES\ROOM FILES\MY ROOM |

|REN FILES\MYROOM PLACE |

|DIR FILES TYPE FILES\AST.FIL |

|TYPE FILES\JUP.FIL |

|MOVE FILES\AST.FIL FILES\JUP.FIL |

|Y then TYPE FILES\AST.FIL |

|TYPE FILES\JUP.FIL |

|MOVE FILES\VEN.FIL FILES\PLACE\VEN.NEW |

|DIR FILES |

|DIR FILES\PLACE |

|MOVE FILES\*.FIL FILES\PLACE\*.TXT |

|MOVE FILES\*.FIL FILES\PLACE |

|DIR FILES |

|DIR FILES\PLACE |

|MOVE FILES\PLACE\*.FIL CLASS |

|DIR FILES\PLACE\*.FIL |

|DIR CLASS\*.FIL |

|MD START\SUBDIR |

|COPY *.FIL START\SUBDIR |

|DIR START /S /B |

|MOVE START FILES |

|DIR START then DIR FILES |

|DIR FILES\START /S /B |

|Activity completed. |

| |

|RD /S REVISTED |

|RD /S Revisited |

|Two ways to remove a directory. |

|RD - removes only empty directory. |

|Bottoms up approach. |

|Two-step process |

|Delete files.(DEL) |

|Delete directory.(RD) |

|RD with /S parameters. |

|Deletes from top down with one command. |

|Can delete files and directories with one command. |

|Deletes entire structure. |

|Powerful but dangerous command. |

| |

|ACTIVITY—USING RD AND RD /S |

|Using RD and RD /S |

|DATA disk in Drive A, A:\> displayed. |

|Activity steps. |

|Key in: |

|RD FILES\PLACE |

|DEL FILES\PLACE |

|RD FILES\PLACE |

|DIR FILES then RD FILES /S |

|Y then DIR FILES |

|Activity completed. |

| |

|BACKING UP YOUR DATA DISK |

|Backing up your Data Disk |

|Always back up all data files. |

|Habit called “Disaster and Recovery Planning”. |

|Backing up application program disks can be tricky. |

|Copy-protected disks cannot be backed up with regular OS commands. |

|Never backup program/software application disks until you understand how they work. |

|Application software on diskette provides instructions on how to back up software. |

|Hard disks. |

|To copy use special operating commands and procedures. |

|Cannot and should not back up hard disk using techniques that will be described. |

|Contents of hard disk will not fit on one floppy disk. |

|Three ways to back up data files. |

|DISKCOPY. |

|Copies entire disk - all files/subdirectories. |

|Can be used on floppy disks. |

|COPY. |

|Backs up files from floppy disk to floppy disk. |

|Copies specific files in specific directories on hard disk. |

|XCOPY. |

|Covered later in book. |

|Never use MOVE for backup purposes. |

|Removes files from original location. |

|End up with only one copy of data files. – Defeats purpose of backing up files. |

|Is useful in placing files onto floppy disk from hard disk. |

|Acquire regular backup routine. |

|Can lose data. |

|Purchase tape backup if possible. |

|Used to backup hard disk without having to sit in front of computer and inserting floppy disks. |

|If have writable CD can copy files to CD. |

|Message is BACK UP DATA FILES. |

| |

|ACTIVITY—BACKING UP WITH THE DISKCOPY COMMAND |

|Backing up with the DISKCOPY Command |

|DATA disk in Drive A. C:\> displayed. |

|DISKCOPY requires media types be the same. |

|Activity steps. |

|Change to C drive. Label blank disk “BACKUP DATA disk”. |

|Key in: DISKCOPY A: A: & press |

|Remove original DATA disk from Drive A. Insert blank disk labeled BACKUP DATA disk into Drive A then press |

|Press N then remove disk labeled BACKUP DATA DISK and keep it in a safe place until it is needed again to make another backup. |

|Activity completed. |

| |

|BACKING UP FILES WITH THE COPY COMMAND |

|Backing up Files with COPY Command |

|This material is to be read, not done. |

|DISKCOPY. |

|Backs up an entire floppy disk. |

|Formats new disk. |

|Usually only need to back up selected files from hard disk to floppy or removable drive. |

|COPY. |

|Used to backup specific files. |

|Used to back up files from one floppy to another. |

|Used to copy files in individual subdirectory. |

|Be sure files fit on floppy disk. |

|Does not format new disk. |

|Can only be used if you have two removable drives. |

|If using two disk drives, COPY does not require identical disk media types. |

|Used to back up files from a hard disk. |

|Cannot and must not be used to copy all files from a hard disk to a floppy disk. |

|Will not fit on a single floppy. |

|Are backup utilities to back up large volumes– need destination other than floppy disk. |

|Make regular backups. |

|Back up files that have changed or are new. |

|Back up in relation as to how long it would take to recreate your data. |

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

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

Google Online Preview   Download