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
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)
Please log in to answer
Posted by:
Jsaylor
14 years ago
Posted by:
anonymous_9363
14 years ago
Is there a reason for NOT using the FileSystemObject object's CopyFolder method?
Posted by:
Jsaylor
14 years ago
Posted by:
AngelD
14 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.