|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
'objFSObject.CopyFile' trouble
I am having some trouble getting this command to work.
In essence, I want to copy 100+ files from the server to several PC's connected to the server. Each user will run this script to get the files copied to their machine. (Although I eventually want to automate that step as well so the user doesn't have to do a thing.) I'm not sure what I am missing, but I get the error: File not Found. Here's my code: vb Code:
I have read though the MSDN library on this topic, and I have my code as they suggest on the webpage. The only thing I can think of is either I don't have the name correct for my server; < Drawings on 'sqlserver' (X: ) > (without the brackets of course) or, I don't have my connection to my drive set properly. But neither of these make sense because I am getting a list of the files in the directory from the server. I'm also not quite sure I need the For Each ... Next Loop either. From my pocket reference manual and the MSDN library, the objFSObject.CopyFile should copy all files in the directory if I am using the wildcard "*.env", so there's no need to loop. But even without the loop, I'm getting the error. Can you show me the error of my ways ?? Thanks. |
|
#2
|
||||
|
||||
|
The problem is in this line.You are providing objects as parameters. The CopyFile method only accepts text strings as parameters. Try this.
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
|
#3
|
|||||
|
|||||
|
Quote:
Ok, I'm probably jumping the gun here but I'm going to put egg on my face anyway, ... HAAAAA !!! I think I've found something that'll stump you. So, I tried what you suggested and I then received the error: Object required: 'X:\temp\Terragen\TERA...' I looked at this piece: Quote:
and then looked at this piece: Quote:
But I still get the error: 'file not found'. Now I did notice on the support text, the destination file is singular and the source file isn't listed per se. Could I possibly be using the wrong command ?? I'm getting the impression the .CopyFile is for individual files and not a whole slew of them. |
|
#4
|
||||
|
||||
|
If you're getting an object required error it most likely means that the script is not connecting to the remote server (or drive).
Are you trying to copy an entire directory? |
|
#5
|
||||||||
|
||||||||
|
You're object error is coming from this line:You can't use an object reference here. It needs to be a string value.
vb Code:
Here's your code rewritten. This should take care of any errors. vb Code:
|
|
#6
|
|||
|
|||
|
Nilpo, I really appreciate your help. Quote:
I think I've got most of it figured out, with the exception of this continual error, "file not found". I'd like to attach some pics of the return I'm getting, but I'm at a loss as to how this works on this board, so I'm going to post them instead. (I hope this works 'cause I'm getting confused) So, I run this ... |