303factory
Registered User.
- Local time
- Today, 21:41
- Joined
- Oct 10, 2008
- Messages
- 136
Hi
I need my code to copy a folder of files into another folder of files. Sometimes the file names may match, it doesnt matter if these files are not copied, or are copied and overwrite the orginal.
The CopyFolder method doesnt work because some files in the target directory are read only. This gives me 'permission denied' errors.
I looked around for an alternative solution and was told to try XCOPY with this code:
Dim oShell, xsource, xdestination
xsource = "C:\TempOutputFolder\User Files\*"
xdestination = "D:\myOtherFolder"
Set oShell = WScript.CreateObject("WScript.Shell")
oShell.Run "XCOPY.EXE xsource xdestination /R /Y"
Set oShell = Nothing
However with this code I'm getting the error 'Object required' on the 4th line, and cant find out why.
Can anyone tell me either why I'm getting this error, or perhaps suggest an alternative? I wouldnt mind using the MakeWritable function on the target folder so I can use CopyFolder, but that only seems to be available in .net
Any help would be much appreciated
303
I need my code to copy a folder of files into another folder of files. Sometimes the file names may match, it doesnt matter if these files are not copied, or are copied and overwrite the orginal.
The CopyFolder method doesnt work because some files in the target directory are read only. This gives me 'permission denied' errors.
I looked around for an alternative solution and was told to try XCOPY with this code:
Dim oShell, xsource, xdestination
xsource = "C:\TempOutputFolder\User Files\*"
xdestination = "D:\myOtherFolder"
Set oShell = WScript.CreateObject("WScript.Shell")
oShell.Run "XCOPY.EXE xsource xdestination /R /Y"
Set oShell = Nothing
However with this code I'm getting the error 'Object required' on the 4th line, and cant find out why.
Can anyone tell me either why I'm getting this error, or perhaps suggest an alternative? I wouldnt mind using the MakeWritable function on the target folder so I can use CopyFolder, but that only seems to be available in .net
Any help would be much appreciated
303