Internal Commands COPY and TYPE Ch 5 1 Overview Will review file-naming rules. Ch 5 2 Overview Will learn some internal commands that can be used to manage and manipulate files. Ch 5 3 Overview The value of creating and using dummy files will be explained. Ch 5 4 Overview Will experience naming, managing, manipulating, viewing, and printing files. Ch 5 5 Overview Use COPY and TYPE commands to perform various tasks. Ch 5 6 Overview Both concatenation and the consequences of overwriting files will be discussed. Ch 5 7 Why Learn Command Line Commands? Review of directory management commands: MD CD RD Ch 5 8 Why Learn Command Line Commands? Directories: Largest units of information management Used to organize programs and data files Ch 5 9 Why Learn Command Line Commands? Need to know how to manage information at the file level. Managing files different from creating/changing data within files. Ch 5 10 Why Learn Command Line Commands? Using the command line will help you understand: File manipulation Disk and subdirectory structure Ch 5 11 Why Learn Command Line Commands? Some tasks are done easier and faster at the command line. Ch 5 12 Why Learn Command Line Commands? Internal file-management commands: DIR COPY REN DEL TYPE Ch 5 13 The COPY Command COPY command: Used to copy files from one place to another Ch 5 14 The COPY Command Reasons for copying files: Copy files from one disk to another Make second copy to existing file on same disk Copy file to device Making changes of existing file with program that created it Create backup copy of various data files Ch 5 15 The COPY Command COPY command syntax: COPY [parameters] [drive:] [path] filename [drive:] [path] filename [parameters] Ch 5 16 The COPY Command Conceptually the syntax is: COPY source destination Ch 5 17 Review of File-Naming Rules File-naming Rules: Names of files in directory must be unique. No names can be longer than 255 characters, including file extensions. File extensions are optional. Ch 5 18 Review of File-Naming Rules File-naming Rules: File name must be separated from its extension with a period, called a dot. All alphanumeric characters can be used in file names and extensions, except the following illegal characters: “ / \ : | < > *?+ Ch 5 19 Review of File-Naming Rules Program files: Named by programmer Commonly have .COM, .EXE, or .BAT extensions Ch 5 20 Review of File-Naming Rules Naming data files: Use names that reflect file contents Extensions usually specify type of file Most application programs assign file extension to data files Ch 5 21 Activity—Making Copies of Files KEY CONCEPTS: Function keys correct typing errors Function of first \ and second \ Function of dot (.) between file name and file extension : lets operating system know that the destination is a drive Ch 5 22 Activity—Making Copies of Files KEY CONCEPTS: Executed several COPY commands Used DIR to confirm files copied Copy and rename files On command line - one step Windows Explorer and My Computer - two steps Ch 5 23 Using Long File Names Floppy disk: Long file names - only when necessary Room for 224 files on Directory Table Uses old FAT16 file system Ch 5 24 Using Long File Names Floppy disk: Designed to hold files with 8.3 rules Directory table full - cannot add files to disk (even if there is room) Ch 5 25 Using Long File Names Fig 5.1 Two Directory Tables p. 192 Ch 5 26 Using Long File Names At command line enclose entire file name in quotes if it has spaces. Use /X with DIR to see both short and long name in directory. Ch 5 27 Using Long File Names Fig 5.2 Directory Showing Short and Long File Names p. 192 Ch 5 28 Using Long File Names For long files names, it is helpful to have meaningful and unique characters within the first six characters of the name. Ch 5 29 Activity—Copying Files with Long File Names KEY CONCEPTS: Copied file to data disk Operating system assigned alias (8.3 file name) Ch 5 30 Using Wildcards with the COPY Command Using wildcards (* and ?) with the COPY command to copy files can reduce the number of commands that have to be typed in. Ch 5 31 Using Wildcards with the COPY Command Wildcards used: With DIR and COPY commands To change destination name Ch 5 32 Activity—Using Wildcards with COPY Command KEY CONCEPTS: Use wildcards to save time when: Copying files Viewing files If NTFS is file system - copy will copy files in alphabetical order Ch 5 33 The TYPE Command TYPE command: Internal command Opens/displays contents of file on screen DIR - displays what files are on disk Must be text/ASCII file for data to be meaningful and readable Ch 5 34 The TYPE Command TYPE command syntax: TYPE [drive:] [path] filename Ch 5 35 Activity—Displaying Files Using TYPE Command KEY CONCEPTS: Text files/ASCII files Recognizing executable code files by file extensions Support files Format - how data is arranged Ch 5 36 Dummy Files Dummy files: Files without particular meaning Usually created for test purposes Usually smaller and are samples Ch 5 37 Activity—Using the Copy and Type Commands KEY CONCEPTS: TYPE can use more than one parameter DIR - displays current files on disks TYPE - displays contents of one file at a time Ch 5 38 Making Additional Files on the Same Disk Can have two files with identical contents on same disk: Including same name - if files kept in different subdirectories In same subdirectory - if the names of the files are different. Ch 5 39 Activity - Using COPY Command KEY CONCEPTS: Review use of: MD and <DIR> (including syntax) Naming subdirectories First backslash (\), other (\) Dot (.) and double dot (. .) Absolute/relative paths COPY command Use of wildcards with TYPE command Ch 5 40 Using Wildcards with the COPY Command Wildcards can be used to copy files in the same drive to a different subdirectory. Ch 5 41 Using Wildcards with the COPY Command It is crucial that syntax is NEVER altered. COPY source destination Ch 5 42 Using Wildcards with the COPY Command Files can be “misplaced”: Computers always follow commands User must know what the computer was told to do Ch 5 43 Activity—Using Wildcards with the COPY command KEY CONCEPTS: Copying/naming files with COPY command Compare moving/renaming files using GUI vs. doing it at the command line Ch 5 44 Using COPY and DIR with Subdirectories COPY command can place file in subdirectories. DIR command can be used to see if files were copied. Ch 5 45 Activity—Using COPY with Subdirectories KEY CONCEPTS: Importance of spacing when keying in commands (COPY command spacing) Use of \ - as a root, as a delimiter When to use absolute/ relative path Changing directories Using DIR to locate files Ch 5 46 Using Subdirectory Markers with the COPY Command Can use shortcuts to write commands: Dot (.) Double dot (..) Ch 5 47 Using Subdirectory Markers with the COPY Command The .. represents parent of current directory. Only directory that does not have a parent is the root directory. Ch 5 48 Activity—Using Shortcuts: The Subdirectory Marker KEY CONCEPTS: Child vs. parent directory Absolute path Using . . Using \ as a delimiter Ch 5 49 Overwriting Files with the COPY Command Each file must have a unique name on same disk and subdirectory. Ch 5 50 Overwriting Files with the COPY Command Overwrite: Old data replaced by new data Ch 5 51 Overwriting Files with the COPY Command Fig 5.4 Overwriting Files p. 264 Ch 5 52 Overwriting Files with the COPY Command Overwrite files on regular basis as you want to backup files. Now Windows informs user that an overwrite will occur. Ch 5 53 Activity—Overwriting Files Using COPY Command KEY CONCEPTS: When overwriting is not allowed Confirmation prior to overwriting Ch 5 54 Combining Text Files with the COPY Command Concatenation is creating another file by combining contents of two or more text (ASCII) files. Ch 5 55 Combining Text Files with the COPY Command Concatenation should never be done with program files, or with data files generated by programs. Ch 5 56 Combining Text Files with the COPY Command To avoid accidental concatenation of files, read all messages DOS displays on the screen. Ch 5 57 Combining Text Files with the COPY Command COPY syntax never changes: COPY source destination Plus sign (+) between source files tells OS that you are joining files. Two or more items separated by pipe symbol (|) - either/or choice Ch 5 58 Activity—Combining Files Using the COPY Command KEY CONCEPTS: Where spaces are in COPY command Join text files with plus sign Never concatenate: Program files Data files created with application programs Read messages Only text files can be combined Wildcards can beChused 5 59 Printing Files Have not printed contents of any file. May have: Redirected output to printer using: DIR command TYPE command Copied file to printer Ch 5 60 Printing Files PRINT command: Prints contents of files Automatically ejects pages Works only for ASCII files Ch 5 61 Printing Files Data files generated by application programs can only be printed from within application program. Ch 5 62 Printing Files Reasons for printing ASCII files: Need hard copy of configuration information on computer Verify if printer problem is a software problem Ch 5 63 Printing Files Three ways to print a text file from the command line: Use PRINT command Use redirection with DIR command Copy contents of file to printer Ch 5 64 Printing Files PRINT command syntax: PRINT [D:device] [[drive:] [path] filename […]] Ch 5 65 Printing in a Lab Environment Printing is complicated without a local printer. Ch 5 66 Activity- Setting Up Printing in a Lab Environment KEY CONCEPTS: Created shortcut to enable printing on the desktop Created second shortcut on desktop to disable command line printing Ch 5 67 Activity—Printing Files KEY CONCEPTS: Print job Status report Can direct output to screen or another device Cannot use redirection with COPY command Ch 5 68