|
 |
asp_databases thread: Error in using objFSO.CopyFile
Message #1 by "James Kim" <james@k...> on Thu, 5 Sep 2002 00:28:33
|
|
Hello fellows,
I am trying to use FileSystemObject copyfile method.
However, I am keep getting following error message.
Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
I checked the line specified in the error message,
but I couldn't find the problem.
I tried not to use variables for source and destination, it didn't work.
Can anybody tell what the problem is?
Thank you and here is my coding.
James
-------copyfile.asp-------
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
strFolder = "D:\directory\att\01"
strSource = "D:\directory\att\file\test.doc"
strDest = "D:\directory\att\01\test.doc"
IF objFSO.FolderExists(strFolder) THEN
IF objFSO.FileExists(strDest) THEN
Set objFSO = Nothing
ELSE
objFSO.CopyFile(strSource, strDest)
END IF
ELSE
objFSO.CreateFolder(strFolder)
objFSO.CopyFile(strSource, strDest)
END IF
Message #2 by "Gerhard Wentink" <gerhard@d...> on Thu, 5 Sep 2002 06:24:46 +0200
|
|
The problem is just what the error message tells you:
Remove the parentheses and it will work.
objFSO.CopyFile strSource, strDest
Regards,
Gerhard Wentink
>-----Original Message-----
>From: James Kim [mailto:james@k...]
>Sent: Thursday, September 05, 2002 12:29 AM
>To: ASP Databases
>Subject: [asp_databases] Error in using objFSO.CopyFile
>
>
>Hello fellows,
>
>I am trying to use FileSystemObject copyfile method.
>However, I am keep getting following error message.
>
>Error Type:
>Microsoft VBScript compilation (0x800A0414)
>Cannot use parentheses when calling a Sub
>
>I checked the line specified in the error message,
>but I couldn't find the problem.
>I tried not to use variables for source and destination, it
>didn't work.
>Can anybody tell what the problem is?
>Thank you and here is my coding.
>
>James
>
>-------copyfile.asp-------
>
>Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
>strFolder = "D:\directory\att\01"
>strSource = "D:\directory\att\file\test.doc"
>strDest = "D:\directory\att\01\test.doc"
>
>IF objFSO.FolderExists(strFolder) THEN
> IF objFSO.FileExists(strDest) THEN
> Set objFSO = Nothing
> ELSE
> objFSO.CopyFile(strSource, strDest)
> END IF
>ELSE
> objFSO.CreateFolder(strFolder)
> objFSO.CopyFile(strSource, strDest)
>END IF
>
Message #3 by Vijay G <happygv@y...> on Thu, 5 Sep 2002 08:39:47 -0700 (PDT)
|
|
Just remove the parantheses. This will do.
Cheers!!!
Vijay.G
James Kim wrote:
Hello fellows,
I am trying to use FileSystemObject copyfile method.
However, I am keep getting following error message.
Error Type:
Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub
I checked the line specified in the error message,
but I couldn't find the problem.
I tried not to use variables for source and destination, it didn't work.
Can anybody tell what the problem is?
Thank you and here is my coding.
James
-------copyfile.asp-------
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
strFolder = "D:\directory\att\01"
strSource = "D:\directory\att\file\test.doc"
strDest = "D:\directory\att\01\test.doc"
IF objFSO.FolderExists(strFolder) THEN
IF objFSO.FileExists(strDest) THEN
Set objFSO = Nothing
ELSE
objFSO.CopyFile(strSource, strDest)
END IF
ELSE
objFSO.CreateFolder(strFolder)
objFSO.CopyFile(strSource, strDest)
END IF
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
Message #4 by "James Kim" <james@k...> on Thu, 5 Sep 2002 19:48:11
|
|
Thank you Gerhard and Vijay.
In Professional ASP 3.0, it is stated like this ; CopyFile(Source,
destination, overwrite)
I thought copyfile method should work like FileExists or CreateFolder does.
Thank you again guys!
James
|
|
 |