Introduction


This chapter covers some of the common tasks facing administrators when it comes to managing the Windows filesystem. We'll not only touch on the really basic tasks such as creating, deleting, renaming, and moving files and folders, but more advanced topics such as viewing a list of all open files and identifying the process that has a file locked.

Using a Graphical User Interface

You are undoubtedly familiar with the all-purpose file, folder, and shared folder management tool, Windows Explorer. With it you can create, move, rename, and delete files and folders as well as hide, encrypt, and make them read-only. As you'll see, this is the most often used graphical tool in this chapter.

You are also probably familiar with the Shared Folder MMC snap-in (fsmgmt.msc), which is commonly seen as a part of the Computer Management tool. This snap-in allows you to do just about anything with shares (i.e., create, delete, see who is using them, etc.).

Using a Command-Line Interface

As you might expect, there are a host of command-line tools to manipulate files and folders on Windows XP. Table 8-1 lists the command-line tools used in this chapter and the recipes they are used in.

Table 8-1. Command-line tools used in Chapter 8 (continued)

Tool

Location

Recipes

attrib

%SystemRoot%\system32

8.12, 8.13

auditpol

Windows 2000 Resource Kit

8.18

cipher

%SystemRoot%\system32

8.15

compress

Windows Resource Kit

8.14

copy

CMD shell

8.10

creatfil

Windows Resource Kit

8.1

del

CMD shell

8.1

dir

CMD shell

8.5

fc

%SystemRoot%\system32

8.11

findstr

%SystemRoot%\system32

8.9

forfiles

Windows 2000 Resource Kit

8.22

inuse

Windows 2000 Resource Kit

8.16

linkd

Windows Resource Kit

8.7

mkdir

CMD shell

8.2

move

CMD shell

8.10

net file

%SystemRoot%\system32

8.19

net share

%SystemRoot%\system32

8.23, 8.24

openfiles

%SystemRoot%\system32

8.19

ren

CMD shell

8.10

rmdir

CMD shell

8.2

subinacl

Windows Resource Kit

8.17, 8.25

takeown

Windows 2000 Resource Kit

8.17

where

Windows 2000 Resource Kit

8.9


Using Downloadable Software

Sysinternals (http://www.sysinternals.com) produces several file-related utilities, and we use many of them in this chapter. They include File Monitor (Recipe 8.19) for monitoring file activity, Fundelete (Recipe 8.3) for replacing the recycle bin, Shareenum (Recipe 8.24), for enumerating share points on a network, Process Explorer and handle for listing all the file handles a particular process has open (Recipe 8.20), junction for creating junction points (Recipe 8.20), sdelete for securely deleting files (Recipe 8.4), and strings for searching for text strings in binary files (Recipe 8.9).

The other downloadable tools we describe in this chapter include PowerDesk Pro for managing files (Recipe 8.10), WinZip for compressing files (Recipe 8.14), PGP for encrypting files (Recipe 8.15), setacl for setting auditing on files (Recipe 8.18), and folders from the command line and shortcut for creating shortcuts from the command line (Recipe 8.6).

Using VBScript

Between WMI and WSH, you have the ability to automate reading, writing, and searching files and folders. Unfortunately, the WMI file and folder classes don't provide the capability to do basic manipulation, which is where WSH comes in. Table 8-2 lists all the WSH and WMI classes used in this chapter.

Table 8-2. WMI and WSH classes used in Chapter 8

WMI class

Description

Recipes

Cim_DataFile

Enumerate and manage files and folders. (Note that this class represents both files and folders, not just files.)

8.1, 8.5, 8.10, 8.14, 5,17, 8.22

Scripting.FileSystemObject

Read, write, and manipulate files and folders.

8.1, 8.2, 8.11, 8.12, 8.13

Win32_Directory

Enumerate folders.

8.5, 8.14

Win32_ShortcutFile

Enumerate and manage shortcut files (.lnk).

8.6

Win32_Share

Enumerate and manage share points.

8.23, 8.24




Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net