|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CopyFile method not workingI am using following code to copy a file or folder from computer A to computer B. Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile(sFile, sPathDest, True) now problem here is that, if i pass "IP ADDRESS" of my source computer than it is able to copy files & folders but if i am passing "COMPUTER NAME" than it gave a strange error: "Method ' ' of object ' ' failed" its very strange error, and i am not able to fix it. dest.:"\\192.168.2.10\test\copy.txt" is working fine but "\\computer00top\test\copy.txt" is not working. Thing is that, i am able to ping that computer name and able to copy file from there manually, by typing path in explorer. Any help will be appreciated. Thanks, Dipesh
Show quote
Hide quote
"Dipesh_Sharma" <DipeshSha***@discussions.microsoft.com> wrote in message Don't use the FSO for this. Use VB's own FileCopy statement.news:DD3C6331-B915-4B5C-A1F6-E378CB8D2A82@microsoft.com... > Hi, > I am using following code to copy a file or folder from computer A to > computer B. > > Dim fso > Set fso = CreateObject("Scripting.FileSystemObject") > fso.CopyFile(sFile, sPathDest, True) > > now problem here is that, if i pass "IP ADDRESS" of my source computer > than > it is able to copy files & folders but if i am passing "COMPUTER NAME" > than > it gave a strange error: "Method ' ' of object ' ' failed" > its very strange error, and i am not able to fix it. > dest.:"\\192.168.2.10\test\copy.txt" is working fine but > "\\computer00top\test\copy.txt" is not working. Thing is that, i am able > to > ping that computer name and able to copy file from there manually, by > typing > path in explorer. > Any help will be appreciated. > -- Mike On 01/09/2010 19:02, Dipesh_Sharma wrote:
> Hi, Oh Dear.> I am using following code to copy a file or folder from computer A to > computer B. > > Dim fso > Set fso = CreateObject("Scripting.FileSystemObject") > fso.CopyFile(sFile, sPathDest, True) /*Assuming*/ that this is VB, then FileCopy sFile, sPathDest is all you need (OK; with a /bit/ of error handling around it). > dest.:"\\192.168.2.10\test\copy.txt" is working fine but Odd. If anything I'd expect the name to work and not the IPAddress.> "\\computer00top\test\copy.txt" is not working. > Thing is that, i am able to ping that computer name and able to copy How is your program running? A standard VB exe that you run from a > file from there manually, by typingpath in explorer. shortcut? Or something else? Like ASP? Not every process can "see" the network - web applications and Windows Services are two that spring to mind; neither of these, by default, can do anything with the network (to them, it just doesn't exist). But a "normal" VB program that you run should be able to do everything that /you/ can do. Regards, Phill W. "Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-k> wrote in message No, from my experience, IP addresses in UNC paths are far more reliable than news:i5o76v$tfj$1@news.eternal-september.org... >> dest.:"\\192.168.2.10\test\copy.txt" is working fine but >> "\\computer00top\test\copy.txt" is not working. > > Odd. If anything I'd expect the name to work and not the IPAddress. names if you've got screwy DNS going on. I often have to use IP addresses at home vs. computer names. Stupid router.... "Jeff Johnson" <i.get@enough.spam> wrote in message Have you checked your hosts file?news:i5otah$ebi$1@news.eternal-september.org... > from my experience, IP addresses in UNC paths are far more > reliable than names if you've got screwy DNS going on. I often > have to use IP addresses at home vs. computer names. > Stupid router.... Mike "Mike Williams" <M***@WhiskyAndCoke.com> wrote in message I guess I could put the machines with the fixed IPs in my hosts files, but news:i5ovdn$1v5$1@speranza.aioe.org... >> from my experience, IP addresses in UNC paths are far more >> reliable than names if you've got screwy DNS going on. I often >> have to use IP addresses at home vs. computer names. >> Stupid router.... > > Have you checked your hosts file? that doesn't help me with the machines that use DHCP. Sometimes I can hit them by name, sometimes not. Not the end of the world, just frustrating. On 9/3/2010 7:26 AM, Jeff Johnson wrote:
Show quoteHide quote > "Mike Williams"<M***@WhiskyAndCoke.com> wrote in message Is using XCopy or Robocopy an option?> news:i5ovdn$1v5$1@speranza.aioe.org... > >>> from my experience, IP addresses in UNC paths are far more >>> reliable than names if you've got screwy DNS going on. I often >>> have to use IP addresses at home vs. computer names. >>> Stupid router.... >> >> Have you checked your hosts file? > > I guess I could put the machines with the fixed IPs in my hosts files, but > that doesn't help me with the machines that use DHCP. Sometimes I can hit > them by name, sometimes not. > > Not the end of the world, just frustrating. http://www.dslreports.com/forum/r19676024-Xcopy-and-UNC-path-names xcopy \\server\data\*.* \\backup\data /y at the end if you want it to overwrite /s at the end if you want subdirectories copied as well http://ss64.com/nt/robocopy.html ROBOCOPY will accept UNC pathnames including UNC pathnames over 256 characters long. http://www.lordgoogle.com/downloads/robocopy/robocopy.doc Finally, as drive mappings can be changed by users, it is generally best to use UNC names for source and destination directories in scheduled Robocopy jobs, as these explicity specify file locations, and are more reliable. I.e. rather than scheduling a command of the form : ROBOCOPY X:\source Y:\dest ... for increased reliability, you should use commands of the form : ROBOCOPY \\server1\share1\source \\server2\share2\dest ...
Show quote
Hide quote
"Mike S" <ms***@yahoo.com> wrote in message Not really, because usually I just want to browse the share in an Explorer news:i5s2ll$1h6$1@news.eternal-september.org... >>>> from my experience, IP addresses in UNC paths are far more >>>> reliable than names if you've got screwy DNS going on. I often >>>> have to use IP addresses at home vs. computer names. >>>> Stupid router.... >>> >>> Have you checked your hosts file? >> >> I guess I could put the machines with the fixed IPs in my hosts files, >> but >> that doesn't help me with the machines that use DHCP. Sometimes I can hit >> them by name, sometimes not. >> >> Not the end of the world, just frustrating. > > Is using XCopy or Robocopy an option? window.
Error 481 Invalid picture
Global class and WithEvents Distibution of VB6 program Lockup Continues Why doesn't this work (sendmessage) Radio Button Bug? file and folder permissions Showing/Using Sort arrows on vb6 listviews? Closing Grouped instances in the taskbar Componenet not installed correctly by PDW |
|||||||||||||||||||||||