We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
The script runs from the asp page like this: <%if request.form("jobno")>"" then%> <script> window.open("export.vbs") </script> <%end if%> export.vbs below Option Explicit Dim objFSO, objFileCopy, objGuyFile, objFileDelete Dim strFilePath, strDestination, WinHttpReq Dim strFileText, strFileText2, strFileText3 dim fso strFilePath = "\\server1\jobs\source.txt" strDestination ="\\server2\export\destination" Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(strDestination) then ' Delete file if it alread exists in the destination. fso.DeleteFile strDestination,True wscript.echo "File deleted from Server 2" else wscript.echo "File wasn't deleted." end if Set objFSO = CreateObject("Scripting.FileSystemObject") if objFSO.fileexists(strfilePath) then Set objFileCopy = objFSO.GetFile(strFilePath) ' copy the file to destination objFileCopy.copy (strDestination) WSCript.Echo "The new file has been Copied to " & strDestination Wscript.Quit else wscript.echo "This didn't work. New file WAS NOT copied." Wscript.Quit end if ' End of Script
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.