Using Hard Drives Additional information. Hierarchical Filing Systems Why Organize a Hard Disk? ...

50
Using Hard Drives Additional information

Transcript of Using Hard Drives Additional information. Hierarchical Filing Systems Why Organize a Hard Disk? ...

Using Hard Drives

Additional information

Hierarchical Filing SystemsWhy Organize a Hard Disk?Relative and Absolute PathsSubdirectory MarkersThe Current & Default Drive and DirectoryUnderstanding the PATH CommandThe PROMPT Command Metastrings

Chapter 3 adds (50 slides) CTEC 110 2

Important DOS ConceptsUsing Hard Drives

Important DOS CommandsUsing Hard Drives

tree Graphically displays the folder structure of a drive or path

dir Displays a list of files and subdirectories in a directorymkdir or md Creates a directoryrmdir or rd Removes (deletes) a directorychdir or cd Displays the name of or changes the current directorymove Moves files and renames files and directoriespath Displays or sets a search path for executable filesprompt Changes the cmd.exe command promptattrib Displays or changes file attributes (FAT)icacls Displays or modifies discretionary access control lists

(DACLs) on specified files, and applies stored DACLs to files in specified directories. (NTFS)

Chapter 3 adds (50 slides) CTEC 110 3

Hierarchical Filing Systems

Root directory: Created when disk is formatted Represented by (\) - the backslash Acts as an index to disk

Chapter 3 adds (50 slides) CTEC 110 4

FAT16Root directory - fixed size & location on disk

FAT32Root directory free to grow as necessary

NTFSNo limit to # of files/directories in root

directory

Chapter 3 adds (50 slides) CTEC 110 5

Hierarchical Filing Systems

Subdirectories:Important part of organizing diskCan contain subdirectoriesNo limit in number of files

Subdirectory structure:Looks like inverted family treeRoot directory

• At top of tree• Point of entry in hierarchical structure

Chapter 3 adds (50 slides) CTEC 110 6

Hierarchical Filing Systems

Chapter 3 adds (50 slides) CTEC 110 7

Hierarchical Filing Systems

Chapter 3 adds (50 slides) CTEC 110 8

Hierarchical Filing Systems

9Chapter 3 adds (50 slides) CTEC 110

Hierarchical Filing Systems

General comments:Only one root directory

• point of entryDirectories

• Have only one parent directory

• Can have any # of child directories

Chapter 3 adds (50 slides) CTEC 110 10

Hierarchical Filing Systems

Hierarchical Filing Systems

General comments:Each subdirectory

• Dependent upon structure above it

• Knows only its parents and children

User can name subdirectories but not the root directory

Chapter 3 adds (50 slides) CTEC 110 11

Why Organize a Hard Disk?

Windows OS is installed, certain folders are created including:

• Windows • Program Files• Documents and Settings• My Documents

Chapter 3 adds (50 slides) CTEC 110 12

Why Organize a Hard Disk?

Need to determine:How program is installedWhere program is installed

Can choose own installation location.• Presents problems when asking for technical

support.

Chapter 3 adds (50 slides) CTEC 110 13

Why Organize a Hard Disk?

Part of good organizational scheme is to create meaningful names for data files Need naming conventions Long file names problematic Use of spaces can create problems Similar file names problematic

Organize disk by way you work.Application programs are tools.

Chapter 3 adds (50 slides) CTEC 110 14

Example Programs & Data Files

The WUGXP directory contains:The subdirectory “Games” which contains:

The directory “BOG2” which contains:The application program called “BOG”

BOG.EXE is the application program.BOG.DAT is the data file.

Chapter 3 adds (50 slides) CTEC 110 15

Relative path: Route from where you are to where you want

to goCan move to directory above it and beneath it

Absolute path:Direct route from root directory to the

subdirectory of interestIs always absolutely correct

Chapter 3 adds (50 slides) CTEC 110 16

Relative and Absolute Paths

Directory:Knows about files/directories within itselfKnows about its immediate child directory

and parent directoryTo move to another parent directory either

start from the root or give relative path

The root directory is the parent

or common “ancestor” of all directories.

Chapter 3 adds (50 slides) CTEC 110 17

Relative and Absolute Paths

Relative and Absolute Paths

Chapter 3 adds (50 slides) CTEC 110 18

Relative and Absolute Paths

Absolute path examples:cd p:\ctec110cd p:\ctec110\homework\movies

Relative path examples:cd ..cd ctec110cd ..\phone\personalcd ..\..\..

Chapter 3 adds (50 slides) CTEC 110 19

Subdirectory Markers

Single . (one period) Specifies the current directory

Double . . (two periods) Specifies the parent directory of current

subdirectoryCan use . . (two periods)

To move up one directory position

You cannot use this shortcut symbol to move down in the directory hierarchy

Chapter 3 adds (50 slides) CTEC 110 20

The Current and Default Drive and Directory

Using the CD command with no parameters will display the present current and default directory

Example: CD [drive:][path]The CD command does not use spaces as delimiters

Chapter 3 adds (50 slides) CTEC 110 21

When Z: \ > is displayed on screen it is the:PromptDefault drive and directoryCurrent drive and directory

The default drive can be changedThe default directory can be changedDOS Command line is not case sensitive

Chapter 3 adds (50 slides) CTEC 110 22

The Current and Default Drive and Directory

The TREE Command

The TREE command syntax:TREE [drive:] [path] [/F] [/A]

Used to view Disk StructuresPresents a graphic representation of the disk structure

Examples:Shows the disk structure hierarchy

TREE G:TREE N:TREE O:TREE P:TREE C:

Chapter 3 adds (50 slides) CTEC 110 23

The DIR Command

The DIR command syntax:DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N][/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

Displays a list of files and subdirectories in a directoryHas many options and can be used to search for files

Examples:DIR c:\Windows /wDIR c:\Windows /pDIR hosts /sDIR c:\Windows /a:d

Chapter 3 adds (50 slides) CTEC 110 24

The DIR Command

DIR <file/directory> /s/s Searches subdirectories

Try This…cd /d c:\Windows

DIR hosts /s

Now change to the directory the hosts file is in (first entry) and look inside ittype hosts

Chapter 3 adds (50 slides) CTEC 110 25

The MKDIR (MD) Command The MD command syntax:

MKDIR [drive:] path MD [drive:] path

Formatting a disk will prepare it to hold files.Setting up subdirectories prepares the disk to hold logical groups of filesCreate parent and child directory with one command.If parent directory does not exist, the OS will create child directories and any necessary intermediate directories.

Examples:Creates directories and subdirectories

MD c:\salesMD c:\ctec110MD p:\sales\oldMD p:\sales\new

Chapter 3 adds (50 slides) CTEC 110 26

The RMDIR (RD) Command The RD command syntax:

RMDIR [/S] [/Q] [drive:]pathRD [/S] [/Q] [drive:]path

Removes (deletes) a directoryThe directory must be empty unless a switch is used

Examples:Deletes files, directories and subdirectories

RD p:\filesRD p:\history\europeRD p:\history\us

Chapter 3 adds (50 slides) CTEC 110 27

The RMDIR (RD) Command

Used to remove directories

Cannot remove • Directories containing hidden or system files• Directory you are presently in [Current Directory]• Default subdirectory• Root directory

Cannot use with wildcards

Chapter 3 adds (50 slides) CTEC 110 28

Without parameters:Removes only empty subdirectoriesOne file at a time from the bottom up

With parameters:Can remove directory treesCan remove directories …

• with hidden or system files

Can traverse the directory tree from the top down

Chapter 3 adds (50 slides) CTEC 110 29

The RMDIR (RD) Command

RD with /S parameter: Deletes directory and contents …

(subdirectories/files) with one commandRemoves a complete directory tree path

RD with /Q parameter: RD runs in quiet modeUseful, fast, powerful, and DANGEROUS!

Chapter 3 adds (50 slides) CTEC 110 30

The RMDIR (RD) Command

The CHDIR (CD) Command The CD command syntax:

CHDIR [/D] [drive:][path]CHDIR [..]CD [/D] [drive:][path]CD [..]

Displays the name of or changes the current directoryCD with no parameters will display the current and default directoryCD followed by path name will change the current and default directory

• Current is what you see• Default is what the drive is on

The /D parameter will change the default drive and directory

Examples:cdcd z:\ctec110cd /d c:\Windows

Chapter 3 adds (50 slides) CTEC 110 31

The MOVE Command The MOVE command syntax:

MOVE [/Y | /-Y] [drive:][path]filename1[,...] destinationMOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

Moves files and renames files and directoriesCan move one or more filesCan rename a directory

Examples:MOVE text.txt p: (file move)MOVE p:text o:\Books (file move to directory)MOVE letter1,letter2 o:\memos (files moved to directory)MOVE o:\89memos o:\90memos (directory move)

Chapter 3 adds (50 slides) CTEC 110 32

The MOVE Command

MOVE command can:Move files to new locationRename files at the same timeRename directories/subdirectories Safe to move data files and data directories.

Moving program files and renaming program directories could cause programs to fail

Chapter 3 adds (50 slides) CTEC 110 33

The PATH Command The PATH command syntax:

PATH [[drive:] path [;…] [%PATH%]]PATH

Displays or sets a search path for executable filesType PATH ; to clear all search-path settings and direct cmd.exe to search only in the current directoryType PATH without parameters to display the current pathIncluding %PATH% in the new path setting causes the old path to be appended to the new setting.

Examples:pathpath o:;%path%path %path%;p:path ;

Chapter 3 adds (50 slides) CTEC 110 34

Understanding the PATH Command

PATH command:Locates/executes executable program filesSearches

• Memory• Current directory• Subdirectories specified with PATH command

Chapter 3 adds (50 slides) CTEC 110 35

Understanding the PATH Command

Chapter 3 adds (50 slides) CTEC 110 36

The PROMPT Command

The PROMPT Command syntax:PROMPT [text]

Changes the cmd.exe command promptHas a number of Metastrings that can be used

Example:Prompt $p$g (default)Prompt $d$q$g ({date}=>)

Chapter 3 adds (50 slides) CTEC 110 37

The PROMPT Command

PROMPT command without parameters displays current drive and > sign

Changes the way the prompt is displayed and does not change its function

PROMPT command information:Is contained within CMD.EXESyntax - PROMPT [text]Can include Metastrings

Chapter 3 adds (50 slides) CTEC 110 38

PROMPT Command Metastrings

Chapter 3 adds (50 slides) CTEC 110 39

PROMPT Command Metastrings

Chapter 3 adds (50 slides) CTEC 110 40

The ATTRIB Command

The ATTRIB command syntax:ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I] [drive:][path][filename] [/S [/D] [/L]]

Displays or changes file attributes

Example:ATTRIB +R text.txtATTRIB +RSH iosys.sysATTRIB -R text.txtATTRIB /?

Chapter 3 adds (50 slides) CTEC 110 41

The ATTRIB Command

Based on FAT file systemsUsed to determine the attributes of a fileUsed to change the attributes of a fileATTRIB +R text.txt

makes the file read onlyATTRIB -R text.txt

Removes the read onlyATTRIB /?

help on options

Chapter 3 adds (50 slides) CTEC 110 42

The ATTRIB Command

A for Archive

H for Hidden

R for Read-only

S for System

Chapter 3 adds (50 slides) CTEC 110 43

The ICACLS Command

The ICACLS command syntax1. ICACLS name /save aclfile [/T] [/C] [/L] [/Q]2. ICACLS directory [/substitute SidOld SidNew [...]]

/restore aclfile [/C] [/L] [/Q]3. ICACLS name /setowner user [/T] [/C] [/L] [/Q]4. ICACLS name /findsid Sid [/T] [/C] [/L] [/Q]5. ICACLS name /verify [/T] [/C] [/L] [/Q]6. ICACLS name /reset [/T] [/C] [/L] [/Q]7. ICACLS name [/grant[:r] Sid:perm[...]]

[/deny Sid:perm [...]][/remove[:g|:d]] Sid[...]] [/T] [/C] [/L] [/Q][/setintegritylevel Level:policy[...]]

Chapter 3 adds (50 slides) CTEC 110 44

The ICACLS Command The ICACLS command syntax (continued)

1. Stores the DACLs for the files and folders that match the name into aclfile for later use with /restore. Note that SACLs, owner, or integrity labels are not saved.

2. Applies the stored DACLs to files in directory.

3. Changes the owner of all matching names. This option does not force a change of ownership; use the takeown.exe utility for that purpose.

4. Finds all matching names that contain an ACL explicitly mentioning Sid.

5. Finds all files whose ACL is not in canonical form or whose lengths are inconsistent with ACE counts.

6. Replaces ACLs with default inherited ACLs for all matching files

7. See the help on this command for more detailed information!

Chapter 3 adds (50 slides) CTEC 110 45

The ICACLS Command The ICACLS command syntax NOTES (continued)

Sids may be in either numerical or friendly name form. If a numericalform is given, affix a * to the start of the SID.

/T indicates that this operation is performed on all matching files/directories below the directories specified in the name.

/C indicates that this operation will continue on all file errors. Error messages will still be displayed.

/L indicates that this operation is performed on a symbolic link itself versus its target.

/Q indicates that icacls should supress success messages.

Chapter 3 adds (50 slides) CTEC 110 46

The ICACLS Command

Examples:icacls c:\windows\* /save AclFile /T- Will save the ACLs for all files under c:\windows and its subdirectories to AclFile.

icacls c:\windows\ /restore AclFile- Will restore the Acls for every file within AclFile that exists in c:\windows and its subdirectories.

icacls file /grant Administrator:(D,WDAC)- Will grant the user Administrator Delete and Write DAC permissions to file.

icacls file /grant *S-1-1-0:(D,WDAC)- Will grant the user defined by sid S-1-1-0 Delete and Write DAC permissions to file.

Chapter 3 adds (50 slides) CTEC 110 47

The ICACLS Command

Based on NTFS file systemsUsed to determine the attributes of a fileUsed to change the attributes of a fileHas way too many different command

syntaxes to listDo a “help icacls” at the command prompt

to see the different ways to use it

Chapter 3 adds (50 slides) CTEC 110 48

The ICACLS Command

-N user has no access -F user has full access -M user has right to modify/delete file -RX user has read and execute rights -R user has read-only access -W User has write-only access, can’t

delete -D User can delete file /deny Denied attribute access

Chapter 3 adds (50 slides) CTEC 110 49

END of Additional Information

HOMEWORK

Lab 3DOS Quiz 3

Chapter 3 adds (50 slides) CTEC 110 50