How can I copy a file to another server in javascript? The copyfile method does not cop the file.
var strServer = "VMSQA4"
strNewMachFile = "\\" + strServer + "\\D:\\ETL_FILES\\Machine\\"
aqFileSystem.CopyFile("D:\\Automation\\TestData\\ETL\\DELTA\\machine_TC2173.txt", strNewMachFile, true)
Well, this is the point where I have to start wondering if it's worth scripting. So, the question is:
Why do you need to copy that file to a server location?
Because the answer to that may reveal that there might be other ways of achieving the same result. If you're new to writing automation code, JavaScript or otherwise, then I would certainly look for different ways of doing what you want to do. As far as I can find, using the various "aq" objects available in TestComplete, there's not an easy, one line way to do this.
What you MIGHT end up doing is something like using aqFileSystem.MapNetworkDrive to map the drive to a drive letter... that has parameters to it to pass in the username and password that you want.
Then, you can copy the file using the drive letter rather than the UNC path.
Then, use aqFileSystem.DisconnectNetworkDrive to remove the mapping before you move on.