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)



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


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


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


set aFileObj=Nothing
set ws=Nothing

The script has no errors yet it is nt working....Please help
0 Comments   [ + ] Show 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.


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
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
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
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