[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

I want to execute a file copy,  using vbscript and have builtin validation of the file copy.

Posted on 2007-08-08
2
Medium Priority
?
519 Views
Last Modified: 2008-01-09
How can this be done ?
I want the script to check whether it has copied a certain directory and then delete it.
0
Comment
Question by:itbabe
2 Comments
 
LVL 17

Accepted Solution

by:
Tony Massa earned 2000 total points
ID: 19654672
Generally, the file will copy fine, or create an Err Code.  For instance, if the network connection goes down in the middle, the script will throw an error, but if it's REALLY important, you can MD5 checksum both files before deleting it:

http://www.robvanderwoude.com/vbstech_files_md5.html

Copy A File:
Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\FSO\ScriptLog.txt" , "D:\Archive\", OverwriteExisting

Move A File (Copy/Delete)


Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\FSO\ScriptLog.txt" , "D:\Archive\", OverwriteExisting

If err.Number = 0 Then
  objFSO.DeleteFile("C:\FSO\ScriptLog.txt")
Else
  WScript.Echo "There was an error: " & err.Description
End If
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 20379092
You could also use the DOS COPY command with the /V parameter.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question