home *** CD-ROM | disk | FTP | other *** search
- // XCopy.SCP Sample Script to show the new XCopy function
- // Copyright (c) 2000, Vector Networks Limited
- // All Rights Reserved
- //
- // Revision History:
- // 0.0 16-Jun-00 DB - Created.
-
- // The Script attempts to connect to the Client named in variable Client,
- // using the username (and encrypted password) in variable Username.
- // Having made the connection, we try to copy the directory Source
- // into directory Destination.
- //
- // If FileSpec is non-null, it provides a wildcard to match files in the Source
- // directory.
- //
- // Script requirements:-
- // Predefined variables:
- // Client = "TEST"
- // Username = "USER/GBBLLYDGKK"
- // Source = "C:\TEMP"
- // FileSpec = "*.*"
- // Destination = ">C:\"
-
- Function Main ()
- Dim Client as String, Username as String
- Dim Source as String, FileSpec as String
- Dim Destination as String, Path as String
- Dim Status as Integer
-
- SetTransport (T_TCPIP)
-
- If Connect (Client, Username) = TRUE Then
- Print "Connected to Client ", Client
-
- If Trim (Source) = "" then
- Print "No files to transfer!"
- Else
-
- // Handle an empty (wildcard) FileSpec
-
- If Trim (FileSpec) = "" then
- FileSpec = "*.*"
- Endif
-
- // Now, we have the complete source filespec
-
- Path = Source + "\" + FileSpec
-
- // Handle an empty (default) destination
-
- If Trim (Destination) = "" then
-
- // Find the transfer direction. Look for an ">"
- // in Path, as we can only copy files between
- // Control and Client, one or other location
- // must be on the Client.
-
- If InStr (Path, ">") = 0 then
- Destination = ">C:\"
- Else
- Destination = "C:\"
- Endif
- Endif
- Print "Starting file transfer from ", Path, " to ", Destination
- Status = XCopy (Path, Destination)
- Print "Transfer status = ", Status
- Endif
- Wait (2)
- Print "Disconnecting..."
- Disconnect (Client)
- EndIf
- End Function
-