Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling in shell application

Status
Not open for further replies.

ajtsystems

IS-IT--Management
Jan 15, 2009
80
GB
Hi I have a sub which copies files using shell.application and copyhere. It's working however I would like to get some error logging going for any files which dont copy. I've looked through the MSDN pages but there is nothing obvious so I have added my own but it doesnt work


sub backup (arrmem, backupdir)
Err.Clear
set objShell = CreateObject("shell.application")
set Shellfolder = objShell.NameSpace(backupdir)
shellfolder.CopyHere (arrmem), 272

if Err.Number <> 0 then
' An exception occurred
wscript.echo "Exception:" & vbCrLf &_
" Error number: " & Err.Number & vbCrLf &_
" Error description: '" & Err.Description & vbCrLf

end if
wscript.echo now & arrmem & backupdir
end sub

Is there any any way I can for each file\folder copy verify that it has been copied - can I run a checksum check?
 
Isn't an "on error resume next" required to make use of the Err object? Try putting it at the begin of your backup sub routine

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top