Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 3. Software Installation and Fun... > Identify Issues Related to Folder an...

Identify Issues Related to Folder and File Management

Graphical user interface (GUI) tools are often used to manipulate files and folders. For example, Windows systems include Windows Explorer, and it’s rather easy to drag and drop files to move them or right-click to copy and paste them. You should be familiar with how to use the GUI tools for folder and file management.

Many tools are also available from the command prompt. Instead of using a GUI by pointing and clicking, you can type in the commands to achieve the same result. Some of these commands are covered in the following sections.

When using a command, you can modify what it does by using different switches. Switches are identified by a space and forward slash (/), or in some cases with a space and dash (-), followed by a character or string of characters. For example, you can use the xcopy command to copy entire directories or folders, but it doesn’t normally include subdirectories. If you use the /s switch at the end of the command, it includes the subdirectories.

You don’t have to remember all the switches for every single command, but you should remember one. Almost all commands support the use of the help switch (/?). For example, you can view help for the xcopy command by using this command: xcopy /?. If you can’t remember the correct switch to use for any command, enter the command followed by /? and you get help on the command.

Every file and folder within a file system has several different attributes that you can view and modify. Some of the common attributes are

System. System files are marked with this attribute; the operating system provides extra protection to prevent them from being modified.

Hidden. By default, hidden files aren’t displayed in GUIs.

Read-only. Read-only files can be opened to view the contents but not modified or deleted.

Archive. The archive attribute identifies when a file has been backed up and when it has been modified after a previous backup.

You can view and modify these attributes with the attrib command. Using the attrib command without any switches shows the attributes of all the files in the current directory. You can also modify the attributes by using the plus character (+) to set the attribute or by using the minus character (-) to clear the attribute. For example, if you want to set the hidden attribute for a file named StrataStudy.doc, you could use this command: attrib +h StrataStudy.doc. If you want to clear the hidden attribute on the same file, you would use this command: attrib -h StrataStudy.doc.

Create, Delete, Rename, Move, and Print Files

Using the GUI tools is often the easiest way to create, delete, rename, move, and print files. Figure 3-1 shows Windows Explorer on a Windows 7 system. By right-clicking on a file, you are able to open, print, cut, copy, delete, or rename the file. If you cut a file, you can then paste it in a different folder; this action works the same as moving the file by dragging and dropping it. If you right-click in an empty space within the folder, you can also select New to create new documents.

Image

Figure 3-1. Using Windows Explorer

You can also use some basic commands from the command line to perform similar functions. As with most commands, none of these are case sensitive and can be entered using any mixture of upper- and lowercase letters. Examples are shown with mixed case for readability:

Copy. This command allows you to copy files; the basic syntax is copy source destination. You provide the name of the source file you want to copy and the name of the destination file you want to create. For example, the following command copies the StrataStudy.doc file from the C:\Study folder to the C:\Passed folder:

Copy C:\Study\StrataStudy.doc C:\Passed\StrataStudy.doc

Remove. The del and erase commands remove a file from the system. The basic syntax is del filename or erase filename. The following commands erase the StrataStudy.doc file from the C:\Study folder:

Del C:\Study\StrataStudy.doc

Erase C:\Study\StrataStudy.doc

Rename. You can rename files using the rename or ren commands. The basic syntax is ren sourcefile newname. The following commands rename the StrataStudy.doc file to PassedStrataStudy.doc:

Ren C:\Study\StrataStudy.doc PassedStrataStudy.doc

Rename C:\Study\StrataStudy.doc PassedStrataStudy.doc

Move. The move command works like drag and drop or cut and paste within Windows Explorer. The basic syntax is move sourcefile new-location. The following command moves the StrataStudy.doc file from the C:\Study folder to the C:\Passed folder:

Move C:\Study\StrataStudy.doc C:\Passed\

Print. The print command allows you to print text files from the command prompt. The basic syntax is print filename. The following command prints the StrataStudy.txt file to a printer connected to the LPT1 port.

Print C:\Study\StrataStudy.txt

Create, Delete, Rename, and Move Folders

Just as you can create, delete, rename, and move files, you can also do the same with folders. It’s worthwhile pointing out that folders and directories are the same thing. However, when you are using a GUI, it’s common to call them folders and subfolders, but when you’re using the command prompt, it’s common to call them directories or subdirectories.

The biggest difference between manipulating files and folders is the use of the xcopy command. It can copy entire subdirectories and maintain all the same attributes in the copied files. In contrast, the copy command cannot copy subdirectories. The basic syntax of the xcopy command is

xcopy source destination optional-switches

The xcopy command is very rich and supports a wide range of switches. Some of the more relevant switches are

/s. The subdirectory (or subfolder) switch tells xcopy to include all the folders and subfolders when doing the copy. This is one of the most valuable switches used with xcopy and one of the primary reasons to use xcopy instead of the more basic copy command. By default, empty directories are not copied.

/e. The empty switch works like the subdirectory switch (/s) except that it also includes empty directories when copying directories. You can use /s /e or just /e to get the same results.

/c. This switch tells the command to continue copying even if errors are encountered. This prevents the command from copying some of the files and then stopping without your knowing exactly where it stopped.

/o. The ownership switch copies all the permissions assigned to files and folders, including the user account that is assigned ownership. Not all file systems support permissions, but Microsoft’s New Technology File System (NTFS) file system does include access control lists (ACLs), which list assigned permissions.

Assign Folder Structure During Installation

When the operating system is installed, it creates folders based on the needs of the operating system. For example, Windows systems create a Windows folder for all the operating system files and a Program Files folder for application files. User files are stored in different locations in different operating systems:

Windows XP. User files are stored the C:\Documents and Settings folder by default.

Windows Vista and Windows 7. User files are stored in the C:\Users folder by default.

If you’re running a 64-bit version of Windows, you see another folder named C:\Program Files (x86). This folder is used for 32-bit applications that can run on the 64-bit operating system. Although many newer 64-bit applications are available, many 32-bit applications also still run on 64-bit systems. However, the supporting files needed for the 64-bit and 32-bit applications are different, so the files are stored in different locations by default:

64-bit applications on a 64-bit operating system. Program files stored in C:\Program Files folder by default.

32-bit applications on a 64-bit operating system. Program files stored in C:\Program Files (x86) folder by default.

Importance of Following Backup Guidelines and Procedures

Any data that is important to users should be backed up regularly. Data can become corrupt from a wide range of sources, including

Hardware failure. If a hard drive fails, it’s very common for all data on the hard drive to be lost.

Software failure. Software bugs or glitches can accidentally corrupt data.

User error. Users can sometimes accidentally delete or modify data, losing access to the original data.

Viruses and other malicious software. Attackers sometimes intentionally write malicious code that deletes or corrupts data on systems. This sometimes corrupts a user’s data directly. At other times, the malicious code corrupts the hard drive, preventing access to all data on the hard drive.

Although any of these problems can result in the loss of data, the impact of this loss can be minimized by regularly backing up data. If you have a backup, you can restore the data no matter what corrupted it. Backups should be stored on different media than the data being backed up. In other words, if you want to back up data stored on an internal hard drive, you should not store the backup on the same internal hard drive. If this drive becomes corrupt, you lose your backup.