Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 DOS 2 Directory structure of disks Directory structure of disks Full Path or Full file specification Full Path or Full file specification Creating directories.

Similar presentations


Presentation on theme: "1 DOS 2 Directory structure of disks Directory structure of disks Full Path or Full file specification Full Path or Full file specification Creating directories."— Presentation transcript:

1 1 DOS 2 Directory structure of disks Directory structure of disks Full Path or Full file specification Full Path or Full file specification Creating directories ( MD or MKDIR) Creating directories ( MD or MKDIR) Navigating a directory structure ( CD or CHDIR) Navigating a directory structure ( CD or CHDIR) Coping files to other directories ( COPY ) Coping files to other directories ( COPY ) Renaming files ( REN or RENAME ) Renaming files ( REN or RENAME ) Moving files to other directories ( MOVE ) Moving files to other directories ( MOVE ) Deleting files from directories ( DEL or ERASE ) Deleting files from directories ( DEL or ERASE ) Deleting directories ( RD or RMDIR ) Deleting directories ( RD or RMDIR ) Listing files in directories Listing files in directories View, print, and save a directory tree ( TREE ) View, print, and save a directory tree ( TREE )

2 2 Directory Also known as a folder. Also known as a folder. Acts as a container for files and other directories. Acts as a container for files and other directories. Is a special file type that contains information about the files and directories it tracks. Is a special file type that contains information about the files and directories it tracks. Directories provide a means of organizing the many files stored on a disk drive. Directories provide a means of organizing the many files stored on a disk drive.

3 3 Root Directory The ROOT directory is the first directory created. It is created AUTOMATICALLY when the disk is initialized or formatted. Formatting a disk is the ONLY way to create the ROOT directory. The ROOT directory is the first directory created. It is created AUTOMATICALLY when the disk is initialized or formatted. Formatting a disk is the ONLY way to create the ROOT directory. It is referred to with a backslash symbol \. It is referred to with a backslash symbol \. A:\>shows root directory of A drive A:\>shows root directory of A drive Note: The DOS prompt above typically shows you what drive and directory on that drive is the current default ( A:\> ).

4 4 Subdirectory A subdirectory is a directory contained within, or “below” another directory. A subdirectory is a directory contained within, or “below” another directory. This allows the creation of a hierarchy of directories on a disk drive. This allows the creation of a hierarchy of directories on a disk drive. It is subordinate to another directory or folder. It is subordinate to another directory or folder. EXAMPLE: EXAMPLE:A:\Programs\COBOL>_ COBOL is a subdirectory of Programs

5 5 DADBDCF1F2 Root DirectoryDDDEF3F4 DAF5F6F7 DDF20F21F22 DBF30F31 DC … F5 … F6 … F7F8F9F10 DE … F8 … F9 … F10 … F3 … F4 … F1 … F2 … F20 … F21 … F22 … F30 … F31

6 6 Parent Directory A directory containing, or “above”, another directory is reffered to as a parent directory. A directory containing, or “above”, another directory is reffered to as a parent directory. EXAMPLE: EXAMPLE:A:\Programs\COBOL>_ Programs is the parent directory of COBOL Programs is the parent directory of COBOL

7 7 FULL PATH A notation that identifies the exact location of a directory or file on disk. The full path includes the following for a directory or file on a disk: Drive Drive Sequence of directory name(s) separated by backslahes ‘\’. Sequence of directory name(s) separated by backslahes ‘\’. Name of the directory or file Name of the directory or file

8 8 FULL PATH EXAMPLES EXAMPLE: C:\programs\COBOL\Prog1.cob Drive Drive C: C: Sequence of directory name(s) (path) Sequence of directory name(s) (path) \programs\COBOL\ \programs\COBOL\ Name of the directory or file Name of the directory or file Prog1.cob Prog1.cob

9 9 MD - Make Directory The command to create or make a directory is the MD or MKDIR command The command to create or make a directory is the MD or MKDIR command The syntax is : The syntax is : MD [drive:][path]directory name MD [drive:][path]directory name

10 10 MD - Examples Create a directory at the root of A called Programs A:\>MD Programs Create a directory at the root of A called Programs A:\>MD Programs Create a directory at the root of C called Myfiles A:\>MD C:\Myfiles Create a directory at the root of C called Myfiles A:\>MD C:\Myfiles What will the following do? What will the following do? A:\ABC\XYZ>MD Myfiles A:\ABC\XYZ>MD Myfiles

11 11 MD - Subdirectories This creates a subdirectory called Memphis within another directory called CITIES A:\>MD CITIES\Memphis This creates a subdirectory called Memphis within another directory called CITIES A:\>MD CITIES\Memphis This creates a subdirectory called Nashville within the CITIES directory A:\>MD CITIES\Nashville This creates a subdirectory called Nashville within the CITIES directory A:\>MD CITIES\Nashville This creates a subdirectory called Knoxville within the CITIES directory (what’s different here?) A:\CITIES>MD Nashville This creates a subdirectory called Knoxville within the CITIES directory (what’s different here?) A:\CITIES>MD Nashville

12 12 CD - Change Directory The command to change the default directory to a different directory is the CD command. The command to change the default directory to a different directory is the CD command. The syntax is CD [drive:][path]directory name The syntax is CD [drive:][path]directory name

13 13 CD - Examples Change to a directory on the A drive called Programs Change to a directory on the A drive called Programs A:\>CD Programs Change to a subdirectory named Memphis that is under the directory Cities on the C drive Change to a subdirectory named Memphis that is under the directory Cities on the C drive C:\>CD Cities\Memphis A:\>CD C:\Cities\Memphis ??? Change to the root directory of the C drive Change to the root directory of the C drive C:\Cities\Nashville>CD \

14 14 MOVE Syntax: Syntax: MOVE [drive:][path]filespec destination MOVE [drive:][path]filespec destinationExamples: Move a file from one drive to another A:\>MOVE letter.doc C:\ A:\>MOVE \JKL\RST\letter.doc C:\ C:\>MOVE A:\JKL\RST\letter.doc ABC\DEF C:\>MOVE A:\JKL\RST\letter.doc D:\ABC\DEF

15 15 MOVE EXAMPLES Move a file named resume.doc into a directory called WORK Move a file named resume.doc into a directory called WORK A:\>MOVE resume.doc WORK Use a wildcard to move multiple files into a directory called DATES Use a wildcard to move multiple files into a directory called DATES A:\:>MOVE 2000*.* DATES

16 16 COPY file to another directory  Copy a file named resume.doc at the root of A into the directory DOCS on the C drive C:\>COPY A:\resume.doc C:\DOCS  Copy a file named expenses.txt from the COST directory into the PAYMENTS directory on the C drive A:\>COPY C:\COST\expenses.txt C:\PAYMENTS

17 17 COPY files within a directory If the new files are created in the same directory as the old files, the new files must have a different name If the new files are created in the same directory as the old files, the new files must have a different name Example: Example: A:\>COPY oldsales.* newsales.*

18 18 Copying a file Files can be copied Files can be copied Files can be copied from one disk to another Files can be copied from one disk to another Files can be copied from one directory to another Files can be copied from one directory to another When a file is copied, an additional file is created When a file is copied, an additional file is created The original file is left intact The original file is left intact Groups of files can be copied at once by using wildcards Groups of files can be copied at once by using wildcards

19 19 Syntax for COPY Syntax: COPY source [destination] Example: CA:\>COPY classfile.txt classtwo.txt

20 20 PRACTICE COPY Type the following: A:>DIR FILE*.* A:\>COPY classfile.txt file2.txt A:\>COPY file2.txt file3.txt A:\DIR FILE*.*

21 21 Renaming files The name of a file can be changed The name of a file can be changed When this is done, no additional file is created When this is done, no additional file is created The file itself is not moved The file itself is not moved

22 22 RENAMING SYNTAX Syntax: RENAME [drive:][PATH] filename1 filename2 OR REN [drive:][PATH] filename1 filename2 Examples: A:\>REN CLASSFILE.TXT NSTIFILE.TXT C:\ABC>REN A:\ABC\CLASS1.TXT CLASS2.TXT C:\ABC>REN A:\ABC\CLASS1.TXT CLASS2.TXT Notice there is no drive or path for filename2

23 23 PRACTICE RENAME Type in the following: A:\>DIR file*.* A:\>DIR file*.* A:\>RENAME file2.txt file4.txt A:\>RENAME file2.txt file4.txt A:\>DIR file*.* A:\>DIR file*.*

24 24 RENAMING FILES IN ANOTHER DIRECTORY OR DRIVE The name of a file can be changed in a directory that is different than the prompt (the default directory) Syntax: RENAME [drive:][PATH] filename1 filename2 RENAME [drive:][PATH] filename1 filename2 OR OR REN [drive:][PATH] filename1 filename2 REN [drive:][PATH] filename1 filename2Examples: C:\>REN A:\DEMO\CLASSFILE.TXT FILEA.TXT C:\>REN A:\DEMO\CLASSFILE.TXT FILEA.TXT C:\ABC>REN A:\DEMO\CLASS1.TXT FILE1.TXT C:\ABC>REN A:\DEMO\CLASS1.TXT FILE1.TXT

25 25 RENAME with WILDCARDS More than one file can be renamed by the use of wildcards. More than one file can be renamed by the use of wildcards. Examples: Examples: C:\>REN 2002*.DAT 2003*.DAT C:\>REN 2002*.DAT 2003*.DAT C:\ABC>REN A:\XYZ\2002*.DAT 2003*.DAT C:\ABC>REN A:\XYZ\2002*.DAT 2003*.DAT

26 26 PRACTICE REN /wildcards Type in the following: DIR 200* DIR 200* REN 2002* 2003* REN 2002* 2003* DIR 200* DIR 200*

27 27 Deleting files Files can be deleted from the command prompt Syntax: DEL filename Examples: A:\DEL NSTIFILE.TXT A:\ABC>DEL C:\XYZ\FILE.TXT A:\ABC>DEL C:\XYZ\FILE.TXT NOTE: Wildcards can be used to delete groups of files. The following is EXTREMELY dangerous The following is EXTREMELY dangerous A:\DEL *.* A:\DEL *.* A confirmation message will be displayed. A confirmation message will be displayed.

28 28 Prompt Switch and the DELETE command A prompt for verification switch (/P) can be used with the DELETE command A prompt for verification switch (/P) can be used with the DELETE command The names of the files to be deleted will be displayed and the user can verify whether to continue with the deleting The names of the files to be deleted will be displayed and the user can verify whether to continue with the deleting Example: A:\ABC>DEL NSTIFILE.TXT /P Example: A:\ABC>DEL NSTIFILE.TXT /P

29 29 PRACTICE DELETE Type in the following: COPY classfile.txt newfile1.txt COPY classfile.txt newfile1.txt COPY classfile.txt newfile2.txt COPY classfile.txt newfile2.txt DIR *file* DIR *file* DEL newfile1.txt DEL newfile1.txt DIR *file* DIR *file* DEL newfile2.txt /p DEL newfile2.txt /p DIR *file* DIR *file*

30 30 TREE The TREE command will display a directory tree The TREE command will display a directory tree A directory tree is a diagrammatic representation of the directory structure of a hard disk or diskette A directory tree is a diagrammatic representation of the directory structure of a hard disk or diskette

31 31 SYNTAX OF TREE Syntax: Syntax: TREE [drive:][path] Examples: Examples:A:\>TREE A:\>TREE CITIES A:\>TREE C:\ABC\PROGRAMS

32 32 Navigating a Directory Tree Change the directory AND drive in one command Change the directory AND drive in one command A:\>CD /d c:\doc*\letters The above command changes the prompt -drive from A to C -into the documents\letters directory

33 33.. DOT DOT Change to the parent directory of the current directory by typing in the following: Change to the parent directory of the current directory by typing in the following: A:\ABC\JKL>CD.. Directory A:\ABC is now current A:\ABC\JKL>CD.. Directory A:\ABC is now current Type in: A:\Labs\Lab01>CD.. Type in: A:\Labs\Lab01>CD.. And the prompt changes to: A:\Labs> And the prompt changes to: A:\Labs>

34 34 TREE-switches The TREE command has two switches that can be used in display and print The TREE command has two switches that can be used in display and print /Fadds filenames to the directory list /Fadds filenames to the directory list /Adisplays an alternate format /Adisplays an alternate format Example: A:\>TREE /F /A

35 35 Save TREE to a File To save the listing of TREE, use the redirection operator (>) To save the listing of TREE, use the redirection operator (>) Examples: Examples: A:\>TREE > filelist.txt A:\>TREE /F > filelist.txt A:\>TREE /A > filelist.txt A:\>TREE /F /A > filelist.txt

36 36 Print TREE To print the listing of TREE, use the redirection operator (>) To print the listing of TREE, use the redirection operator (>) Examples: Examples: A:\>TREE > LPT1 A:\>TREE > LPT1 A:\>TREE /F > PRN A:\>TREE /F > PRN A:\>TREE /A > PRN A:\>TREE /A > PRN A:\>TREE /F /A > LPT2 A:\>TREE /F /A > LPT2

37 37 XCOPY You can use the XCOPY command to copy all the files in the specified directory and (optionally) all its subdirectories to another drive and/or directory. XCOPY source [destination] [/S] [/M] [/A] XCOPY source [destination] [/S] [/M] [/A]Example: A:\ABC A:\ABC This copies the contents of the current directory to the root of A:.

38 38 XCOPY /S The /S switch enables XCOPY to also copy any directories and files beneath the current directory, but it will NOT include empty directories. Example: A:\ABC /S A:\ABC /S This copies the contents of the current directory and ALL its subdirectories (if not empty) to the root of A:.

39 39 XCOPY /M The /M switch copies files with the archive attribute on and then turns it off.

40 40 XCOPY/A The /A switch copies files with the archive attribute on but does NOT turn it off.


Download ppt "1 DOS 2 Directory structure of disks Directory structure of disks Full Path or Full file specification Full Path or Full file specification Creating directories."

Similar presentations


Ads by Google