On any given day, you probably copy dozens, if not hundreds, of files from one location on your network to another. Chances are, you don’t give the act of copying files a second thought. You probably just open a Windows Explorer window and drag and drop the files from one location to another. If you prefer to use the command line, you may use the Copy or XCopy commands.
These routines work well, but there’s a better way for NetWare administrators and users: the NCopy command. NCopy can copy files faster while preserving special NetWare attributes. I’ll show you how NCopy works and how to run it from the command line and your desktop.
For the purposes of this Daily Drill Down, I’ll be discussing the version of NCopy that comes with NetWare 5.1 Support Pack 4 and the NetWare Copy command contained in the Novell Client 4.83 For Windows NT/2000/XP. The specifics of how your version reacts to such actions as selecting multiple files from the GUI and copying long filenames may vary.
What difference does it make how I copy a file?
Copying files is one of those basic tasks that everyone does without taking into consideration the effect that the action has on the network. When you copy a file from one location to another on your server, your workstation pulls the file from the server and then puts it back on the server at the new location. This causes traffic across your network: the first stream of traffic goes from the server to the workstation, and the second stream of traffic goes from the workstation back to the server.
When you use the Copy command from the command line to copy multiple files, the workstation reads and writes each file one at a time. If you copy many files at once from one location to another on the server, you create a lot of network traffic in short bursts. Potentially, this traffic can cause your entire network to slow down as network packets collide.
The command-line utility XCopy only slightly improves the situation. XCopy reads multiple files into the workstation’s memory at once, until the workstation’s memory cache is full. At that point, XCopy writes the files out to the new location. Using the drag and drop or Cut/Paste functionality from within Windows Explorer works the same way. These massive multiple read/write routines will cause large streams of data to flow to and from your server, although not in the same flood as the plain Copy command. This large stream of data can slow down your network.
NCopy is a NetWare utility that allows you to copy files without putting a burden on your network. When you use the NCopy command to copy files from one directory to another on your server, the data never leaves the server. NCopy is a true client/server application: The workstation issues the command, and the server does the work. This is in exact reverse to most programs you’re used to, in which the server sits there waiting for a workstation to do the work.
Because the data never leaves the server (unless you’ve used NCopy to copy the file to a location other than another volume or directory on the server), the only data that flows across your network is the actual NCopy command itself. Even if you do copy data off of the server, the data still only travels in one direction—from the server to the new location—rather than from the server to your workstation and then from the workstation to the new location.
Another advantage to the NCopy command is that it preserves NetWare attributes. Copy, XCopy, and Windows Explorer only recognize the standard DOS attributes of Archive, Read Only, Hidden, and System. Because NetWare attributes can increase system performance and security, using standard copy commands can actually hurt your server’s overall performance and security. NetWare attributes that NCopy will also copy include:
- Copy Inhibit (Ci): This attribute prevents a file from being copied, but it only works with Macintoshes.
- Delete Inhibit (Di): Similar to the DOS Read Only attribute, this attribute prevents users from deleting the file.
- Don’t Compress (Dc): This attribute prevents NetWare from ever compressing the file.
- Don’t Migrate (Dm): This attribute prevents the file from being moved to another storage device, such as a tape drive.
- Don’t Suballocate (Ds): This attribute disables NetWare’s block suballocation. Using this attribute will cause the file to take more disk space, but it’s useful if the file’s size changes frequently.
- Execute Only (X): This attribute prevents the file from being deleted, renamed, or copied. It’s only valid for .EXE or .COM files.
- Immediate Compress (Ic): This attribute compresses the file immediately.
- Purge (P): This attribute causes the file to be permanently deleted if a user deletes the file, preventing the Filer command from undeleting the file.
- Read-Only (Ro): This attribute is different from the DOS Read Only attribute. This attribute allows the file to be read but not modified. If you choose this attribute, NetWare automatically adds the Delete Inhibit and Rename Inhibit attributes to the file.
- Read-Write (Rw): This attribute allows the file to be both read and written to.
- Rename Inhibit (Ri): This attribute prevents the user from renaming the file.
- Shareable (Sh): This attribute allows more than one user to open the file at the same time.
- Transactional (T): This attribute is normally only used on database files in conjunction with NetWare’s Transactional Tracking System (TTS). The attribute allows TTS to protect the file from becoming corrupted.
You can use the NCopy command two ways. You can issue the NCopy command from a command prompt or from your workstation’s desktop GUI by selecting it from the N icon in your workstation’s system tray. The command-line version of NCopy will work whether or not you’re using Novell Client on your workstation. Because the N icon only appears in the system tray when you’ve installed Novell Client, you must first install Novell Client to issue the command from within your workstation’s GUI.
The command-line version of NCopy uses the same basic syntax of Copy or XCopy. Type ncopy directory1\ file directory2\file, where directory1 and directory2 represent the source and target directories, respectively, and file represents the name of the file. In addition to the basic command, you can use switches at the end of the basic syntax to further enhance NCopy. Switches you can use include:
- /A – This switch copies only files that have the Archive attribute. Unlike the XCopy command, NCopy won’t remove the Archive bit after copying the file to the new location.
- /C – This switch copies the files but doesn’t preserve NetWare’s extended attributes.
- /F – This switch forces NetWare to copy sparse files. Sparse files are normally used only by database applications and are a result of NetWare’s attempt to squeeze more disk space out of files that may otherwise waste it. Normally, NetWare won’t copy sparse files.
- /I – This switch informs you if extended attributes can’t be copied to the destination.
- /M – This switch copies files that have the Archive attribute set, but unlike the /A switch, /M will remove the Archive attribute from the source file.
- /R – Unless the Ci attribute is set on a file, Novell will normally compress the file only if it hasn’t been used for a predetermined amount of time. This switch recompresses the file immediately after copying it to the target location.
- /R/U – This switch forces the file to remain compressed on the target location even if the destination normally doesn’t support compression.
- /S – This switch copies the files in the current directory and any subdirectory.
- /S/E – Like the /S switch, this switch copies files in the current directory and any subdirectory, but it also copies the names of any empty subdirectories.
- /V – This switch causes NCopy to verify that the file was written properly to the destination by doing a binary compare with the source file.
Be aware that NCopy can act funny when you try to copy long filenames. NCopy was designed in the age of DOS when all filenames conformed to the 8.3 file format; it doesn’t understand long filenames that exceed this limit. If you try to type ncopy longfilename.nam z:\public and press [Enter], NCopy will issue an error that says that the source path is invalid.
You can get around this problem two ways. First, try using a wildcard character to copy the file. For example, ncopy *.nam z:\public will cause the file to copy correctly to the Public folder, even though the Longfilename.nam exceeds the 8.3 limit.
Second, you can use the Windows 9x abbreviation for long filenames. If you’re in a Windows NT or Windows 2000 environment and can’t see the Windows 9x abbreviation, you can discover it by typing dir /x at the command prompt in the directory where the file resides. For our example, the abbreviated filename could be Longfi~1.nam, in which case the proper NCopy command would be ncopy longfi~1.nam z:\public. If you open Windows Explorer and look at the final copied file, you’ll notice that, even though you had to use the abbreviated name for the file, the full filename copied properly.
Copying files from the desktop
When you have Novell Client installed on your workstation, you have another choice to use in copying files from one location to another. Novell Client’s Setup program adds the N icon to the system tray of your workstation and also integrates portions of the Client with Windows Explorer.
You have two options when copying files from your workstation’s desktop. First, you can go through the N menu by clicking N | NetWare Utilities | NetWare Copy. You’ll see the Select File Or Folder To Copy screen appear, as shown in Figure A.
|You can copy files from your desktop.|
On this screen, browse the Network Resources window until you find the file that you want to copy and click OK. If you want to copy the contents of an entire folder, you can do so by selecting the folder and clicking OK. Unfortunately, using Select File Or Folder To Copy, you can select only one file or folder at a time to copy.
After you click OK, you’ll see the NetWare File Copy Utility screen, shown in Figure B. On this screen, you’ll choose the destination by either entering the path of the destination in the To field or by selecting the Browse button.
|After you select the file to copy, you can specify options about how NetWare should copy the file.|
The File Copy Options box allows you to specify other options during the copy process. By default, the Keep Attributes On Copy radio button is selected, which matches all special NetWare attributes on the target with the source. If you select Modify Attributes On Copy, the NetWare File Attributes box becomes available. There, you can change attributes for the target file. When you’re ready to copy the files, click OK.
The second way you can copy files from the desktop is to open Windows Explorer and find the file or files you want to copy. Right-click the file and select NetWare Copy. Unlike from the N menu, you can select and copy multiple files in Explorer.
When you click NetWare Copy, the NetWare File Copy Utility appears exactly like it does from the N menu. However, because you can select multiple files from Explorer, you may see more than one file listed in the Copy These Files And Folders field.
Even though you don’t necessarily always give copying files much thought, the way you go about doing it can have an effect on your network’s performance and security. In a NetWare environment, using NCopy can help ensure that NetWare attributes don’t change and that the network doesn’t get flooded with unnecessary traffic.