2.2 NWFileMgr Object

Features:

2.2.1 CurrentDir property

Returns the entry object that represents the current working directory.

Syntax

Object.CurrentDir

Type

Entry.

Attributes

Read-only.

Example

This example returns an Entry object that represents the current working directory.

Set filemgr = Createobject("ucx:NWFileMgr") 
Set currentDir=filemgr.Currentdir 
Print(currentDir.Name)

See Also

2.2.2 ChangeDir method

Changes the current working directory.

Syntax

Object.ChangeDir(
   Path As String)

Parameters

Path

The absolute or relative path to the directory that is to be set as the current working directory.

Return Values

Boolean. Returns TRUE if the current working directory is changed successfully.

Remarks

If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.

Example

This example changes the current working directory to the NSN directory on volume Sys.

Set nwdir = Createobject("ucx:NWDir")
nwdir.FullName = "NDS:\\acme-tree\context" 
’Authenticate to tree
nwdir.login ("username", "password")
Set filemgr = Createobject("ucx:NWFileMgr") 
Set CurrentDir = filemgr.currentdir 
Print (CurrentDir.Name)
If (filemgr.Changedir("sys:\nsn") Then
   Print "Successfully changed the working directory"
Else
   Print "Unable to change the working directory"
End If

2.2.3 Copy method

Copies a file within the NetWare file system.

Syntax

Object.Copy(
  (SrcFile As String, 
   TgtFile As String)

Parameters

SrcFile

The short name or absolute full name of the source file.

TgtFile

The short name or absolute full name of the target file.

Return Values

Boolean. Returns TRUE if the file is copied successfully.

Remarks

If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.

Example

This example copies the file test.nlm from the system directory on volume Sys to the temp directory on the same volume.

Set filemgr = Createobject("ucx:NWFileMgr") 
If
fileMgr.Copy("Sys:system\text.nlm","sys:temp\test.nlm") Then
  Print "Successfully copied the file"
Else
  Print "Unable to copy the file"
End If

See Also

2.2.4 FindEntry method

Finds a file or directory by path.

Syntax

Object.FindEntry(
   Path As String)

Parameters

Path

The path to the Entry object (file or directory) to search.

Return Values

Entry. Returns the Entry object corresponding to the specified path.

Remarks

If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.

Example

This example finds the file dir.bas in the NSN\util directory on volume Sys.

Set filemgr = Createobject("ucx:NWFileMgr") 
Set entry = filemgr.FindEntry("Sys:NSN\util\dir.bas")
Print entry.Name

See Also

2.2.5 GetTrusteePaths method

Returns the path for a Trustee object.

Syntax

Object.GetTrusteePaths(
   ObjectName As String, 
   [VolName As AnyType])

Parameters

ObjectName

The name of the Trustee object.

VolName

Optional. The volume name or number. Can be either a String or an Integer.

Return Values

TrusteePaths. Returns the path that corresponds to the Trustee object.

Example

This example returns the trusteepaths for the Admin object on volume sys.

Set filemgr = Createobject("ucx:NWFileMgr") 
Set Tpaths = filemgr.GetTrusteepaths("Admin","sys") 
Tpaths.Reset()
While(Tpaths.Hasmoreelements()) 
     Set Tpath = Tpaths.Next()
     Print ("Path "&Tpath.path&" rights "&Tpath.rights)
Wend

2.2.6 Parse method

Parses a file or directory.

Syntax

Object.Parse(
   Fullname As String)

Parameters

Fullname

The name of the file or directory to parse.

Return Values

ParsedName. Parses the specified file or directory.

Example

This example parses the file dir.bas.

Set filemgr = Createobject("ucx:NWFileMgr") 
Set pObj = fileMgr.Parse("Sys:NSN\util\dir.bas") 
Print(pObj.Name)

See Also