/build/static/layout/Breadcrumb_cap_w.png

Need urgent Help iIn coping a folder using vb scipt

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

Answers (4)

Posted by: Jsaylor 11 years ago
Second Degree Blue Belt
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.
Posted by: anonymous_9363 11 years ago
Red Belt
0
Is there a reason for NOT using the FileSystemObject object's CopyFolder method?
Posted by: Jsaylor 11 years ago
Second Degree Blue Belt
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.
Posted by: AngelD 11 years ago
Red Belt
0
Or the OP needs to be consistence!

The question says one thing and the posted script does something else.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ