Instructor’s Manual Chapter 6

Lecture Notes Using DEL, REN, MOVE, and RD /S

Chapter 6

Using DEL, REN, MOVE, and RD /S

LECTURE N0TES

CHAPTER OUTLINE / TEACHING SUGGESTIONS
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.
  • UseDEL to erase unwanted files.
  • Internal command.
  • Always resident in memory.
  • File gone forever once <Enter> 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/Directories
  • UseDEL to eliminate files on other drives and subdirectories.
  • Syntax remains - DELnames.
  • Names refers to designated drives, subdirectories, or files you wish to delete.
  • ReviewDEL syntax.
  • NoticeDEL and names are not in brackets – they are required.
  • 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 COMEDY.TV
  • REN COMEDY.TV FUNNY.TV
  • DIR COMEDY.TV
  • DIR FUNNY.TV
  • TYPE FUNNY.TV
  • 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 REN on Different Drives/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
  • 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 FILESTYPE 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 <Enter>
  • Remove original DATA disk from Drive A. Insert blank disk labeled BACKUP DATA disk into Drive A then press <Enter>
  • 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.
/ Slides 2-4
Chapter Overview duplicated in PowerPoint slides.
After completion of lecture, shoud review Objectives and Outcomes found on first page of chapter as a check to see if they have mastered concepts.
SECTION 6.1 (pp. 248-249)
Slides 5-11
DEL and ERASE commands work the same way. Text will discuss DEL.
OS does not erase but overwrites old files as FAT "unallocated" the space.
Parameters.
- /P – prompts before each file deleted.
- /F – forces deletion of read-only files.
- /S – deletes specified files from current directory and all subdirectories.
- /A – deletes files based on specified attributes.
- - R - Read only.
- - S – System.
- - A – Archive.
- - S – System.
- - H – Hidden.
- ~ - Prefix meaning “not”.
  • Discussion Question (1) - Explain why you may want to eliminate files from a disk.
  • Discussion Question (2) - When you delete a file, the file is not actually removed from the disk. What really happens?
  • Discussion Question (3) - Give the syntax of the DEL command and explain each part of the syntax.
SECTION 6.2 (pp. 249-251)
Slide 12
DIR checks to see if file on disk.
DEL does not confirm prior to deletion.
Drive letter or \ not included, even though these are mandatory parameters because OS assumed default drive and directory.
SECTION 6.3 (p. 251)
Slide 13
Wise to use DIR command first.
SECTION 6.4 (pp. 252-253)
Slide 14

SECTION 6.5 (p. 253)

Slides 15-18
OS follows instructions and does not check to see if correct file is being deleted.
Placing drive designator or subdirectory in wrong place can completely change the meaning and results of an instruction.
- Explain why first command is incorrect and second one is correct.
SECTION 6.6 (pp. 253-258)
Slide 19
DIR shows that file is there.
Root (\) assumed –does not need to be keyed in.
(\) – used as delimiter must be keyed in.
DEL eliminates file.
Use COPY in order to have two identical named files on different drives.
SECTION 6.7 (p. 258)
Slide 20
Discuss.
- Strength of wildcards is also weakness.
  • Discussion Question (4) – Explain the following statement, with regards to the DEL command. The strength of wildcards is also a weakness.

SECTION 6.8 (pp. 258-261)

Slide 21
Prior to global erase use DIR
Files deleted with wildcards and DEL not recoverable by OS.
Wildcards can be used when files in subdirectory.
  • Discussion Question (5) - When deleting files, why should you key in DIR with global file specifications first?

SECTION 6.9 (p. 261)

Slides 22-24
Purpose of parameters specific to command.
- With DIR - /P means pause.
- With DEL - /P verifies prior to file deletion.
  • Discussion Question (6) - Explain the purpose and function of the /P parameter with the DEL command. The /S?
SECTION 6.10 (pp. 261-265)
Slide 25
/P - confirm if want to delete file.
- Y = delete file
- N = do not delete file.
DIR confirms what files are not deleted on DATA disk.
/S – traverse directory tree.
Can use more than one parameter at a time.
SECTION 6.11 (pp. 265-266)
Slides 26-31
REN – paste new label on file folder.
COPY - like photocopy machine - have original & copy.
RENAME and REN are same.
  • Discussion Question (7) - Why would you want to change the name of a file?
  • Discussion Question (8) - Explain the purpose and function of the RENAME or REN command.
  • Discussion Question (9) - Give the syntax of the REN command and explain each part of the syntax.
  • Discussion Question (10) - What is the difference between the REN and RENAME commands?
  • Discussion Question (11) - What is the difference between the RENAME and COPY commands?

SECTION 6.12 (pp. 266-269)