473,651 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to FileCopy to remote machine?

In a multi-user environment, I have a table that stores hyperlinks to
documents that are stored on the machine that hosts the mdb database. The
table entry looks like this:

ProductDescript ion.htm#file:\\ DBHOST\C$\Docum ents and
Settings\Admini strator\My
Documents\Produ cts\Documents\P roductDescripti on.htm

Having the hyperlink in this format allows the document to be opened by
anyone on the local area network.

The problem is when a remote user wants to add a document link - I have a
function that will populate the table with the above string, but how do I
copy the document to the DBHOST?

I've tried using FileCopy:

FileCopy C:\DirectoryonR emoteMachine\Pr oductDescriptio n.htm
\\DBHOST\C$\Doc uments and Settings\Admini strator\My
Documents\Produ cts\Documents\P roductDescripti on.htm

But that doesn't work.

Do I need to use the API here?

Private Declare Function CopyFile Lib "kernel32" _
( _
existingfile As String, _
newfile As String, _
failIfExists As Boolean _
)

It's safe to assume that a drive is mapped to the DBHOST - is there a way to
determine the drive letter and construct a target path that way? Other
options?

Thanks in advance.
Nov 13 '05 #1
6 5855
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

As far as I know the target file path has this syntax:

\\server_name\d rive:\folder_na me\file_name

E.g.:

xcopy c:\myfile.txt \\SharedServer\ \D:\SharedDocs\ Joes_File.txt

Copies myfile.txt to the server "SharedServ er," D: drive, folder
"SharedDocs ," into the file Joes_File.txt.

Of course, the machines must be on the same network and the source
machine/user must have permissions to copy files into the target
machine.

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQUneI4echKq OuFEgEQIndACg+e llJ2XF9GFzQoTi+ rtfX+4jg9kAnjQv
ReQxs+CrPRpRkzU AKGMdDG1Q
=pVK6
-----END PGP SIGNATURE-----
deko wrote:
In a multi-user environment, I have a table that stores hyperlinks to
documents that are stored on the machine that hosts the mdb database. The
table entry looks like this:

ProductDescript ion.htm#file:\\ DBHOST\C$\Docum ents and
Settings\Admini strator\My
Documents\Produ cts\Documents\P roductDescripti on.htm

Having the hyperlink in this format allows the document to be opened by
anyone on the local area network.

The problem is when a remote user wants to add a document link - I have a
function that will populate the table with the above string, but how do I
copy the document to the DBHOST?

I've tried using FileCopy:

FileCopy C:\DirectoryonR emoteMachine\Pr oductDescriptio n.htm
\\DBHOST\C$\Doc uments and Settings\Admini strator\My
Documents\Produ cts\Documents\P roductDescripti on.htm

But that doesn't work.

Do I need to use the API here?

Private Declare Function CopyFile Lib "kernel32" _
( _
existingfile As String, _
newfile As String, _
failIfExists As Boolean _
)

It's safe to assume that a drive is mapped to the DBHOST - is there a way to
determine the drive letter and construct a target path that way? Other
options?


Nov 13 '05 #2
> xcopy c:\myfile.txt \\SharedServer\ \D:\SharedDocs\ Joes_File.txt

Hi and thanks for the reply.

Well, I could try xcopy instead of FileCopy - but I still need to discover
the drive letter (used by the client) that maps to the DBHOST machine. I
think I need to walk some registry keys for this... ?

By the way, I'm not sure why I'm using $ in my links (in the table). This
works, but not sure why:

ProductDescript ion.htm#file:\\ DBHOST\C$\Docum ents and
Settings\Admini strator\My
Documents\Produ cts\Documents\P roductDescripti on.htm

This link, and the document it points to, is stored on the DBHOST machine
(all documents are stored on the DBHOST machine) - so the drive letter (C$)
is consistent. But the client may have any letter mapped to the DBHOST.
So, if a remote machine attempts to add a document (i.e. link a document to
a customer entry in the database), and the document is located on the remote
machine, the document must first be copied to the DBHOST (as well as adding
the link to the table) - that's why I need the drive letter. I think I read
something about using the registry to determine drive mappings... or, I
could just tell users to use a specific drive letter when mapping to the
database.
Nov 13 '05 #3
"deko" <ww************ *************** ****@nospam.com > wrote in
news:Qf******** ***********@new ssvr27.news.pro digy.com:
In a multi-user environment, I have a table that stores hyperlinks to
documents that are stored on the machine that hosts the mdb database.
The table entry looks like this:

ProductDescript ion.htm#file:\\ DBHOST\C$\Docum ents and
Settings\Admini strator\My
Documents\Produ cts\Documents\P roductDescripti on.htm

Having the hyperlink in this format allows the document to be opened
by anyone on the local area network.

The problem is when a remote user wants to add a document link - I
have a function that will populate the table with the above string,
but how do I copy the document to the DBHOST?

I've tried using FileCopy:

FileCopy C:\DirectoryonR emoteMachine\Pr oductDescriptio n.htm
\\DBHOST\C$\Doc uments and Settings\Admini strator\My
Documents\Produ cts\Documents\P roductDescripti on.htm

But that doesn't work.

Do I need to use the API here?

Private Declare Function CopyFile Lib "kernel32" _
( _
existingfile As String, _
newfile As String, _
failIfExists As Boolean _
)

It's safe to assume that a drive is mapped to the DBHOST - is there a
way to determine the drive letter and construct a target path that
way? Other options?

Thanks in advance.


If you're prepared to use Visual Basic Scripting, then this may help.
You'll need a Reference to the Scripting Library.
It's one of these on my Win98 Access97 machine.

C:\WINDOWS\SYST EM\SCRRUN.DLL
C:\WINDOWS\SYST EM\MSSCP.DLL
C:\WINDOWS\SYST EM\WSHOM.OCX

(This may be Overkill, of course)

'Visual Basic Scripting Edition Language Reference
'FileSystemObje ctSample Code
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' FileSystemObjec t Sample Code
' Copyright 1998 Microsoft Corporation. All Rights Reserved.
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Option Explicit

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' Regarding code quality:
' 1) The following code does a lot of string manipulation by
' concatenating short strings together with the "&" operator.
' Since string concatenation is expensive, this is a very
' inefficient way to write code. However, it is a very
' maintainable way to write code, and is used here because this
' program performs extensive disk operations, and because the
' disk is much slower than the memory operations required to
' concatenate the strings. Keep in mind that this is demonstration
' code, not production code.
'
' 2) "Option Explicit" is used, because declared variable access is
' slightly faster than undeclared variable access. It also prevents
' bugs from creeping into your code, such as when you misspell
' DriveTypeCDROM as DriveTypeCDORM.
'
' 3) Error handling is absent from this code, to make the code more
' readable. Although precautions have been taken to ensure that the
' code will not error in common cases, file systems can be
' unpredictable. In production code, use On Error Resume Next and
' the Err object to trap possible errors.
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' Some handy global variables
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
Dim TabStop
Dim NewLine

Const TestDrive = "C"
Const TestFilePath = "C:\Test"

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' Constants returned by Drive.DriveType
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
Const DriveTypeRemova ble = 1
Const DriveTypeFixed = 2
Const DriveTypeNetwor k = 3
Const DriveTypeCDROM = 4
Const DriveTypeRAMDis k = 5

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' Constants returned by File.Attributes
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
Const FileAttrNormal = 0
Const FileAttrReadOnl y = 1
Const FileAttrHidden = 2
Const FileAttrSystem = 4
Const FileAttrVolume = 8
Const FileAttrDirecto ry = 16
Const FileAttrArchive = 32
Const FileAttrAlias = 64
Const FileAttrCompres sed = 128

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' Constants for opening files
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
Const OpenFileForRead ing = 1
Const OpenFileForWrit ing = 2
Const OpenFileForAppe nding = 8

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' ShowDriveType
' Purpose:
' Generates a string describing the drive type of a given Drive object.
' Demonstrates the following
' - Drive.DriveType
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
Function ShowDriveType(D rive)

Dim s

Select Case Drive.DriveType
Case DriveTypeRemova ble
s = "Removable"
Case DriveTypeFixed
s = "Fixed"
Case DriveTypeNetwor k
s = "Network"
Case DriveTypeCDROM
s = "CD-ROM"
Case DriveTypeRAMDis k
s = "RAM Disk"
Case Else
s = "Unknown"
End Select

ShowDriveType = s

End Function

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' ShowFileAttr
' Purpose:
' Generates a string describing the attributes of a file or folder.
' Demonstrates the following
' - File.Attributes
' - Folder.Attribut es
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Function ShowFileAttr(Fi le) ' File can be a file or folder

Dim s
Dim Attr

Attr = File.Attributes

If Attr = 0 Then
ShowFileAttr = "Normal"
Exit Function
End If

If Attr And FileAttrDirecto ry Then s = s & "Directory "
If Attr And FileAttrReadOnl y Then s = s & "Read-Only "
If Attr And FileAttrHidden Then s = s & "Hidden "
If Attr And FileAttrSystem Then s = s & "System "
If Attr And FileAttrVolume Then s = s & "Volume "
If Attr And FileAttrArchive Then s = s & "Archive "
If Attr And FileAttrAlias Then s = s & "Alias "
If Attr And FileAttrCompres sed Then s = s & "Compressed "

ShowFileAttr = s

End Function

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' GenerateDriveIn formation
' Purpose:
' Generates a string describing the current state of the
' available drives.
' Demonstrates the following
' - FileSystemObjec t.Drives
' - Iterating the Drives collection
' - Drives.Count
' - Drive.Available Space
' - Drive.DriveLett er
' - Drive.DriveType
' - Drive.FileSyste m
' - Drive.FreeSpace
' - Drive.IsReady
' - Drive.Path
' - Drive.SerialNum ber
' - Drive.ShareName
' - Drive.TotalSize
' - Drive.VolumeNam e
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Function GenerateDriveIn formation(fso)

Dim Drives
Dim Drive
Dim s

Set Drives = fso.Drives
s = "Number of drives:" & TabStop & Drives.Count & NewLine & NewLine

' Construct 1st line of report.
s = s & String(2, TabStop) & "Drive"
s = s & String(3, TabStop) & "File"
s = s & TabStop & "Total"
s = s & TabStop & "Free"
s = s & TabStop & "Available"
s = s & TabStop & "Serial" & NewLine

' Construct 2nd line of report.
s = s & "Letter"
s = s & TabStop & "Path"
s = s & TabStop & "Type"
s = s & TabStop & "Ready?"
s = s & TabStop & "Name"
s = s & TabStop & "System"
s = s & TabStop & "Space"
s = s & TabStop & "Space"
s = s & TabStop & "Space"
s = s & TabStop & "Number" & NewLine

' Separator line.
s = s & String(105, "-") & NewLine

For Each Drive In Drives
s = s & Drive.DriveLett er
s = s & TabStop & Drive.path
s = s & TabStop & ShowDriveType(D rive)
s = s & TabStop & Drive.IsReady

If Drive.IsReady Then
If DriveTypeNetwor k = Drive.DriveType Then
s = s & TabStop & Drive.ShareName
Else
s = s & TabStop & Drive.VolumeNam e
End If
s = s & TabStop & Drive.FileSyste m
s = s & TabStop & Drive.TotalSize
s = s & TabStop & Drive.FreeSpace
s = s & TabStop & Drive.Available Space
s = s & TabStop & Hex(Drive.Seria lNumber)
End If

s = s & NewLine

Next

GenerateDriveIn formation = s

End Function

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' GenerateFileInf ormation
' Purpose:
' Generates a string describing the current state of a file.
' Demonstrates the following
' - File.Path
' - File.Name
' - File.Type
' - File.DateCreate d
' - File.DateLastAc cessed
' - File.DateLastMo dified
' - File.Size
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Function GenerateFileInf ormation(File)

Dim s

s = NewLine & "Path:" & TabStop & File.path
s = s & NewLine & "Name:" & TabStop & File.Name
s = s & NewLine & "Type:" & TabStop & File.Type
s = s & NewLine & "Attribs:" & TabStop & ShowFileAttr(Fi le)
s = s & NewLine & "Created:" & TabStop & File.DateCreate d
s = s & NewLine & "Accessed:" & TabStop & File.DateLastAc cessed
s = s & NewLine & "Modified:" & TabStop & File.DateLastMo dified
s = s & NewLine & "Size" & TabStop & File.Size & NewLine

GenerateFileInf ormation = s

End Function

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' GenerateFolderI nformation
' Purpose:
' Generates a string describing the current state of a folder.
' Demonstrates the following
' - Folder.Path
' - Folder.Name
' - Folder.DateCrea ted
' - Folder.DateLast Accessed
' - Folder.DateLast Modified
' - Folder.Size
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Function GenerateFolderI nformation(Fold er)

Dim s

s = "Path:" & TabStop & Folder.path
s = s & NewLine & "Name:" & TabStop & Folder.Name
s = s & NewLine & "Attribs:" & TabStop & ShowFileAttr(Fo lder)
s = s & NewLine & "Created:" & TabStop & Folder.DateCrea ted
s = s & NewLine & "Accessed:" & TabStop & Folder.DateLast Accessed
s = s & NewLine & "Modified:" & TabStop & Folder.DateLast Modified
s = s & NewLine & "Size:" & TabStop & Folder.Size & NewLine

GenerateFolderI nformation = s

End Function

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' GenerateAllFold erInformation
' Purpose:
' Generates a string describing the current state of a
' folder and all files and subfolders.
' Demonstrates the following
' - Folder.Path
' - Folder.SubFolde rs
' - Folders.Count
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Function GenerateAllFold erInformation(F older)

Dim s
Dim SubFolders
Dim SubFolder
Dim Files
Dim File

s = "Folder:" & TabStop & Folder.path & NewLine & NewLine
Set Files = Folder.Files

If 1 = Files.Count Then
s = s & "There is 1 file" & NewLine
Else
s = s & "There are " & Files.Count & " files" & NewLine
End If

If Files.Count <> 0 Then
For Each File In Files
s = s & GenerateFileInf ormation(File)
Next
End If

Set SubFolders = Folder.SubFolde rs

If 1 = SubFolders.Coun t Then
s = s & NewLine & "There is 1 sub folder" & NewLine & NewLine
Else
s = s & NewLine & "There are " & SubFolders.Coun t & " sub folders" _
& NewLine & NewLine
End If

If SubFolders.Coun t <> 0 Then
For Each SubFolder In SubFolders
s = s & GenerateFolderI nformation(SubF older)
Next
s = s & NewLine
For Each SubFolder In SubFolders
s = s & GenerateAllFold erInformation(S ubFolder)
Next
End If

GenerateAllFold erInformation = s

End Function

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' GenerateTestInf ormation
' Purpose:
' Generates a string describing the current state of the C:\Test
' folder and all files and subfolders.
' Demonstrates the following
' - FileSystemObjec t.DriveExists
' - FileSystemObjec t.FolderExists
' - FileSystemObjec t.GetFolder
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Function GenerateTestInf ormation(fso)

Dim TestFolder
Dim s

If Not fso.DriveExists (TestDrive) Then Exit Function
If Not fso.FolderExist s(TestFilePath) Then Exit Function

Set TestFolder = fso.GetFolder(T estFilePath)

GenerateTestInf ormation = GenerateAllFold erInformation(T estFolder)

End Function

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' DeleteTestDirec tory
' Purpose:
' Cleans up the test directory.
' Demonstrates the following
' - FileSystemObjec t.GetFolder
' - FileSystemObjec t.DeleteFile
' - FileSystemObjec t.DeleteFolder
' - Folder.Delete
' - File.Delete
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Sub DeleteTestDirec tory(fso)

Dim TestFolder
Dim SubFolder
Dim File

' Two ways to delete a file:

fso.DeleteFile (TestFilePath & "\Beatles\Octop usGarden.txt")

Set File = fso.GetFile(Tes tFilePath & "\Beatles\Bathr oomWindow.txt")
File.Delete

' Two ways to delete a folder:
fso.DeleteFolde r (TestFilePath & "\Beatles")
fso.DeleteFile (TestFilePath & "\ReadMe.tx t")
Set TestFolder = fso.GetFolder(T estFilePath)
TestFolder.Dele te

End Sub

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' CreateLyrics
' Purpose:
' Builds a couple of text files in a folder.
' Demonstrates the following
' - FileSystemObjec t.CreateTextFil e
' - TextStream.Writ eLine
' - TextStream.Writ e
' - TextStream.Writ eBlankLines
' - TextStream.Clos e
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Sub CreateLyrics(Fo lder)

Dim TextStream

Set TextStream = Folder.CreateTe xtFile("Octopus Garden.txt")

' Note that this does not add a line feed to the file.
TextStream.Writ e ("Octopus' Garden ")
TextStream.Writ eLine ("(by Ringo Starr)")
TextStream.Writ eBlankLines (1)
TextStream.Writ eLine ("I'd like to be under the sea in an octopus'
garden in the shade,")
TextStream.Writ eLine ("He'd let us in, knows where we've been -- in his
octopus' garden in the shade.")
TextStream.Writ eBlankLines (2)

TextStream.Clos e

Set TextStream = Folder.CreateTe xtFile("Bathroo mWindow.txt")
TextStream.Writ eLine ("She Came In Through The Bathroom Window (by
Lennon/McCartney)")
TextStream.Writ eLine ("")
TextStream.Writ eLine ("She came in through the bathroom window protected
by a silver spoon")
TextStream.Writ eLine ("But now she sucks her thumb and wanders by the
banks of her own lagoon")
TextStream.Writ eBlankLines (2)
TextStream.Clos e

End Sub

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' GetLyrics
' Purpose:
' Displays the contents of the lyrics files.
' Demonstrates the following
' - FileSystemObjec t.OpenTextFile
' - FileSystemObjec t.GetFile
' - TextStream.Read All
' - TextStream.Clos e
' - File.OpenAsText Stream
' - TextStream.AtEn dOfStream
' - TextStream.Read Line
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Function GetLyrics(fso)

Dim TextStream
Dim s
Dim File

' There are several ways to open a text file, and several
' ways to read the data out of a file. Here's two ways
' to do each:

Set TextStream = fso.OpenTextFil e(TestFilePath &
"\Beatles\Octop usGarden.txt", OpenFileForRead ing)

s = TextStream.read All & NewLine & NewLine
TextStream.Clos e

Set File = fso.GetFile(Tes tFilePath & "\Beatles\Bathr oomWindow.txt")
Set TextStream = File.OpenAsText Stream(OpenFile ForReading)
Do While Not TextStream.AtEn dOfStream
s = s & TextStream.Read Line & NewLine
Loop
TextStream.Clos e

GetLyrics = s

End Function

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' BuildTestDirect ory
' Purpose:
' Builds a directory hierarchy to demonstrate the FileSystemObjec t.
' We'll build a hierarchy in this order:
' C:\Test
' C:\Test\ReadMe. txt
' C:\Test\Beatles
' C:\Test\Beatles \OctopusGarden. txt
' C:\Test\Beatles \BathroomWindow .txt
' Demonstrates the following
' - FileSystemObjec t.DriveExists
' - FileSystemObjec t.FolderExists
' - FileSystemObjec t.CreateFolder
' - FileSystemObjec t.CreateTextFil e
' - Folders.Add
' - Folder.CreateTe xtFile
' - TextStream.Writ eLine
' - TextStream.Clos e
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Function BuildTestDirect ory(fso)

Dim TestFolder
Dim SubFolders
Dim SubFolder
Dim TextStream

' Bail out if (a) the drive does not exist, or if (b) the directory is
being built
' already exists.

If Not fso.DriveExists (TestDrive) Then
BuildTestDirect ory = False
Exit Function
End If

If fso.FolderExist s(TestFilePath) Then
BuildTestDirect ory = False
Exit Function
End If

Set TestFolder = fso.CreateFolde r(TestFilePath)

Set TextStream = fso.CreateTextF ile(TestFilePat h & "\ReadMe.tx t")
TextStream.Writ eLine ("My song lyrics collection")
TextStream.Clos e

Set SubFolders = TestFolder.SubF olders
Set SubFolder = SubFolders.Add( "Beatles")
CreateLyrics SubFolder
BuildTestDirect ory = True

End Function

''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''
' The main routine
' First, it creates a test directory, along with some subfolders
' and files. Then, it dumps some information about the available
' disk drives and about the test directory, and then cleans
' everything up again.
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''

Sub Main()

Dim fso

' Set up global data.
TabStop = Chr(9)
NewLine = Chr(10)

Set fso = CreateObject("S cripting.FileSy stemObject")

If Not BuildTestDirect ory(fso) Then
MsgBox "Test directory already exists or cannot be created. Cannot
continue."
Exit Sub
End If

MsgBox GenerateDriveIn formation(fso) & NewLine & NewLine
MsgBox GenerateTestInf ormation(fso) & NewLine & NewLine
MsgBox GetLyrics(fso) & NewLine & NewLine
DeleteTestDirec tory fso

End Sub

<www.clearpointsystems.com
Nov 13 '05 #4
> If you're prepared to use Visual Basic Scripting, then this may help.
You'll need a Reference to the Scripting Library.
It's one of these on my Win98 Access97 machine.

C:\WINDOWS\SYST EM\SCRRUN.DLL
C:\WINDOWS\SYST EM\MSSCP.DLL
C:\WINDOWS\SYST EM\WSHOM.OCX

(This may be Overkill, of course)


Looks interesting. I'll play around with it - but yeah, it is a bit much.
I'm thinking I could popup a form - if the first attempt to copy fails -
asking the user which drive is mapped to the DBHOST - and then use that
input to rewrite the copy string and try again.
Nov 13 '05 #5
"deko" <ww************ *************** ****@nospam.com > wrote in
news:3f******** ***********@new ssvr27.news.pro digy.com:

(This may be Overkill, of course)


Looks interesting. I'll play around with it - but yeah, it is a bit
much. I'm thinking I could popup a form - if the first attempt to copy
fails - asking the user which drive is mapped to the DBHOST - and then
use that input to rewrite the copy string and try again.


A much better idea. As you said, interesting, but Scripting Host on a
Business machine has always seemed a little too hacker-prone.

Sorry I had to send code instead of the link. I Googled " FileSystemObjec t
Sample Code" and tried the Microsoft link but it had died.

In fact, if you _do_ decide to take that approach, You'd be better off
looking for a more specific example.

Cheers,
Alan Carpenter
Nov 13 '05 #6
"deko" <ww************ *************** ****@nospam.com > wrote in message news:<3f******* ************@ne wssvr27.news.pr odigy.com>...
If you're prepared to use Visual Basic Scripting, then this may help.
You'll need a Reference to the Scripting Library.
It's one of these on my Win98 Access97 machine.

C:\WINDOWS\SYST EM\SCRRUN.DLL
C:\WINDOWS\SYST EM\MSSCP.DLL
C:\WINDOWS\SYST EM\WSHOM.OCX

(This may be Overkill, of course)


Looks interesting. I'll play around with it - but yeah, it is a bit much.
I'm thinking I could popup a form - if the first attempt to copy fails -
asking the user which drive is mapped to the DBHOST - and then use that
input to rewrite the copy string and try again.


Expecting an intelligent user? haven't we been here before? I'd just
use the UNC, which CAN'T be messed up... (well, not too easily!)
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2996
by: Marina Anufreichik | last post by:
Hi, After deploymnet web application on web server I can access page on local machine and login fine but when I'm trying to access web site from remote machine I can see login page, but when I'm trying to login with correct credentials it give me error: Server Error in '/PDVMgr' Application. ----------------------------------------------------------------------------
9
5879
by: cantelow | last post by:
Hi. I've got a program printing multiple pdf reports, and I need to wait for completion of various associated operations- The pdf printer prints to one file, then I need to copy that where I need it, then delete the old file, repeat with the next report. I need to wait for each step to complete or I get errors due to the previous thing being open and not done yet. Is there any elegant way to do that? My FileCopy in particular has...
10
6314
by: BLiTZWiNG | last post by:
When I try the following: System.IO.File.Copy("C:\\test_read\\test.txt", "\\\\192.168.0.5\\test_write\\test.txt", false) I get an UnauthorizedAccessException. I cannot however, seem to find out how to authorize the file copy (ie. process the user/pass).
4
4673
by: Rohith | last post by:
I need to import dlls that are present in the remote machine. Its a dll written in C that exposes methods. I want to import that dll in my C# application. But that dll is not present in the local machine. Its not a webservice. I need something like remote method invocation(but dlls).
1
2419
by: PRM | last post by:
Hi I have an ASp.net application using C#. I need to copy a file present on the web server machine to a remote machine on the network. Although this seems to be a trivial matter I am having difficulties copying the exe I am Trying string Source = @"c:\temp\test.exe" string Destination = @"Z:\test.exe" File.Copy(Source, Destination, true)
3
5698
by: Michel Smit | last post by:
Hello, I have a question. We have a webserver in a domain, DomainA, and a webserver in a DMZ with local users and groups only. I'm trying to copy a file from the DomainA webserver to the DMZ webserver. Het firewall is configured to allow traffic via NetBIOS by ip-address. File copy takes place in a .NET assembly. Problem is described as follows: when copying I get an error 'access denied'
7
2587
by: | last post by:
I'm writing an ASP.NET app, using Visual Studio 2003. VS is running locally on my laptop, but the web app is running on a remote server. My laptop is not in the domain. I do have a domain account. I had no issue creating the web app on the remote server after authenticating with the domain account, but I can't debug. It complains that I don't have rights. My domain account is in the administrators group on the remote machine. I also have...
4
4217
by: Noy B | last post by:
Hi, I have developed a small application that is using a MSAccess DB. the problem is that it was developed on a machine where the application and the DB are both located. now it needs to be change that the application will be able to run on any other machine (using \\ syntax on the run command- not a problem) using the DB located on a static-different machine. for this purpose I need to create a Remote Connection from my
3
6620
by: Yves Gagnon | last post by:
Hi, I try to debug a WCF hosted in a windows services on a serveur that is on an other domaine then my developpement machine. I tried many things without succes. Here is what I tried: First I installed on the server I want to debug, the remote debugger tools from the VS 2005 CD. I just install the windows application. I tried from there to debug, without succes. I could connect to the remote machine only when the msvsmon.exe is in the...
0
8361
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8807
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8584
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7299
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.