Hi people,
I have been tryin to copy a folder using vb script

dim aFileObj,srcfile,desfile,ws,I,IsOverWrite,SysRoot,srcdir,desdir,DirFlag

dim files(2)

IsOverWrite=False

DirFlag=True


set ws = CreateObject("Wscript.Shell")
'Getting System Root i.e C:\
SysRoot = ws.ExpandEnvironmentStrings("%WinDir%")

SysRoot=Mid(SysRoot,1,3)


srcdir= ws.CurrentDirectory & "\GWMCONFIG"
msgbox srcdir
desdir= SysRoot & "Program Files\Kofax\ImgCtls"
msgbox desdir

files(0)="C.bat"
files(1)="A.bat"


set aFileObj=CreateObject("Scripting.FilesystemObject")

if DirFlag then
if not aFileObj.FolderExists(desdir) then
aFileObj.CreateFolder desdir
end if
end if



for I=0 to ubound(files)

if aFileObj.FileExists(srcdir & files(I)) then
on error resume next
aFileObj.CopyFile (srcdir & files(I)),(desdir & files(I)),IsOverWrite
msgbox aFileObj
end if

next

set aFileObj=Nothing
set ws=Nothing

The script has no errors yet it is nt working....Please help
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
srcdir resolves to: C:\program files\Kofax\ImgCtls

Files(0) resolves to: c.bat

srcdir & files(0) resolves to: C:\program files\Kofax\imgctlsc.bat


I'm sure you can figure out the rest from there.
Answered 06/22/2010 by: Jsaylor
Second Degree Blue Belt

Please log in to comment
0
Is there a reason for NOT using the FileSystemObject object's CopyFolder method?
Answered 06/23/2010 by: VBScab
Red Belt

Please log in to comment
0
Yeah, I tried to stay away from those kinds of questions. That's a dangerous, mentally damaging path you're traveling down there Ian.
Answered 06/23/2010 by: Jsaylor
Second Degree Blue Belt

Please log in to comment
0
Or the OP needs to be consistence!

The question says one thing and the posted script does something else.
Answered 06/24/2010 by: AngelD
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity