home *** CD-ROM | disk | FTP | other *** search
- Indirect Files
-
- Indirect files allow you to have access to a file without explicitly
- referencing its directory or changing your PATH statement. An indirect file
- is linked to another file on a network drive. Any operation on the indirect
- file is actually made on the file to which it points.
-
- For example, suppose you have a file you reference often, such as a data or
- an include file. We ll use the file ORIGINAL.BAT which resides in the root
- directory of the server HOST1 as an example. The physical path of this file
- is as follows:
-
- C:\ORIGINAL.BAT
-
- The network resource name for the C: drive is C-DRIVE. The network path of
- this file is as follows:
-
- \\HOST1\C-DRIVE\ORIGINAL.BAT
-
- With this information, you can set up an indirect file in another directory
- to point to ORIGINAL.BAT
-
- 1. Make sure the network resource where you will create the indirect file
- has the indirect file (I) access right enabled. For information on
- setting ACL rights refer to "Shared Resources" in this manual.
-
- 2. Log in to the server and redirect one of your drives to the network
- resource C-DRIVE on HOST1. You can perform these functions through
- either the NET program or by NET command line.
-
- 3. Change to the directory where you would like to place the indirect file. In
- this example UTIL:
-
- CD UTIL
-
- 4. Create the indirect file using the syntax:
-
- NET INDIRECT PATHNAME ACTUAL-NAME
-
- where PATHNAME represents the name of the indirect file you would like
- to create and ACTUAL-NAME represents the name of the file to link with
- the indirect file. We'll name the indirect file INDIRECT.BAT:
-
- NET INDIRECT INDIRECT.BAT \C-DRIVE\ORIGINAL.BAT
-
- Here we've specified the absolute path to the file INDIRECT.BAT will
- reference. You can also give the relative path to ORIGINAL.BAT:
-
- NET INDIRECT INDIRECT.BAT ..\ORIGINAL.BAT
-
- If you use the DIR command for the subdirectory, you will see the indirect
- file INDIRECT.BAT listed with the other files there.
-
- You will notice that the date and month of the indirect file cannot
- possibly exist. Indirect files will have this date and time to help
- distinguish them from regular DOS files. The NET DIR command will also
- help distinguish indirect files. Note that the NET DIR command shows
- the I in the file attributes display as well as the name of the file to which INDIRECT.BAT points.
-
- You may now access ORIGINAL.BAT from the UTIL subdirectory. If you
- want to see the contents of ORIGINAL.BAT simply issue a TYPE command
- for INDIRECT.BAT:
-
- Type INDIRECT.BAT
-
- Since INDIRECT.BAT is a batch file, you can execute it by typing:
-
- INDIRECT
-
- The result would be the same as if you had typed:
-
- ..\ORIGINAL
-
- or
-
- C:\ORIGINAL
-
- You can also link other indirect files to INDIRECT.BAT, and have access
- to ORIGINAL.BAT from any other subdirectory. For example, you could
- link the file IND2.BAT in the APPS subdirectory to INDIRECT.BAT. To do
- this:
-
- 1. Change to the APPS subdirectory.
-
- 2. Type the command:
-
- NET INDIRECT IND2.BAT \C-DRIVE\UTIL\INDIRECT.BAT
-
- A directory of the APPS directory would now include the indirect file
- IND2.BAT. Any requests to IND2.BAT would actually be performed on
- ORIGINAL.BAT.
-
- Note: The DELETE, RENAME and SET ATTRIBUTE functions are always performed
- on the indirect file, not the file to which it points.
-
-
- LINKING INDIRECT FILES TO DIRECTORIES
-
- You can also create indirect files to reference directories. That way
- you can have access to a entire directory of files without having to
- change your PATH statement or specifically reference that subdirectory.
- This is useful if you have a directory of files you use often. Follow
- the steps given previously, except this time link the indirect file to a directory. For example:
-
- NET INDIRECT INDIRECT.DIR \C-DRIVE\MACROS
-
- If you have the proper ACL rights for the directory MACROS you will be
- able to utilize any of the files within the directory, by referencing
- them through INDIRECT.DIR. If you wanted to run the file TEST.EXE in
- MACROS you could type:
-
- INDIRECT.DIR\TEST
-
- This would be the same as typing:
-
- C:\MACROS\TEST
-
-
- FILE LEVEL SECURITY
-
- One advantage of indirect files is that you can set access to a specific
- file without having to give that type of access to the entire directory.
- For example, if you give L (Look up) access to a network directory PROT
- (Short for PROTected), but want to be able read and write to the file
- ORIGINAL.DOC while in that directory, you can do the following:
-
- Place ORIGINAL.DOC in another network resource such as READWRIT and allow
- read and write access for that resource.
-
- Using the steps described earlier, create an indirect file such as
- INDIRECT.DOC in PROT linked to \READWRIT\ORIGINAL.DOC.
-
- All of the files in the PROT directory would only have L look up access,
- but you would be able to read and write to ORIGINAL.DOC through
- INDIRECT.DOC.
-
- Conversely, you can allow users access to PROT, but if they do not have
- the R and W access to READWRIT, they cannot read or write to ORIGINAL.DOC.
-
- Note: Some text editors read data from a file and then write over the
- previous copy when you save the file. These functions can result in the
- text editor reading the data from the original file, then writing the
- new version to the indirect file when you save it. When this occurs,
- you no longer have an indirect file, but simply an updated copy of the
- original file.
-
-
- THE NET EXPAND COMMAND
-
- When using indirect files, you can utilize the NET EXPAND to keep track
- of which file will finally be accessed. This is especially useful if
- you have multiple layers of indirect files. The NET EXPAND command,
- will also help you find the physical or network path of the indirect
- file. You can use the NET EXPAND command four ways: first, you can
- use the command with no switches:
-
- NET EXPAND IND2.BAT
-
- Using the example created earlier, you would see this output:
-
- \\HOST1\C-DRIVE\APPS\IND2.BAT
-
- This output tells you where the file exists relative to the network.
- In this case the file is located on the server HOST1, on the resource
- C-DRIVE in the subdirectory APPS. If you use the Recurse (/R) switch
- for IND2.BAT:
-
- NET EXPAND/R IND2.BAT
-
- you will see this output:
-
- \\HOST1\C-DRIVE\ORIGINAL.BAT
-
- This switch instructs the NET program to recursively search through all
- the levels of indirect files until it arrives at the final file
- referenced. Once again, the information given is relative to the files
- location on the redirected drive. To find the actual physical location
- of IND2.BAT on the server, you would use the Physical (/P) switch:
-
- NET EXPAND/P IND2.BAT
-
- You would see the output:
-
- C:\APPS\IND2.BAT
-
- To find out the physical location of the file to which IND2.BAT finally
- resolves, you would use both the Recurse and Physical switches:
-
- NET EXPAND/P/R IND2.BAT
-
- You will see the output:
-
- C:\ORIGINAL.BAT.
-
- the physical location of the file to which IND2.BAT finally resolves.
-