
Signature
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
> Let me provide additional information.
>
[quoted text clipped - 21 lines]
>>
>> Thanks
Ron,
Thanks for the suggestion but I could not find in your pages what I need to
do.
> See also
> http://www.rondebruin.nl/folder.htm
[quoted text clipped - 24 lines]
> >>
> >> Thanks
urkec - 30 Mar 2008 15:24 GMT
You could try copying files individually using FSO File.Move, and if it
returns 'file exists' error (58), use a different name. Something like this
(please be careful, this is not tested):
strSourceFolder = "c:\source\"
strDestFolder = "d:\destination\"
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objSourceFolder = objFso.GetFolder(strSourceFolder)
For Each objFile In objSourceFolder.Files
On Error Resume Next
objFile.Move strDestFolder
If Err.Number = 58 Then
i = 1
Do While Err.Number <> 0
Err.Clear
objFile.Move strDestFolder & "Copy Of " & _
objFso.GetBaseName(objFile) & _
" (" & i & ")" & "." & _
objFso.GetExtensionName(objFile.Path)
i = i + 1
Loop
Else
Debug.Print Err.Number, Err.Description
End If
On Error GoTo 0
Next

Signature
urkec
> Ron,
>
[quoted text clipped - 29 lines]
> > >>
> > >> Thanks
Nils Titley - 31 Mar 2008 16:25 GMT
Urkec,
Your code worked perfectly. Thanks for helping me.
> You could try copying files individually using FSO File.Move, and if it
> returns 'file exists' error (58), use a different name. Something like this
[quoted text clipped - 67 lines]
> > > >>
> > > >> Thanks
Ron de Bruin - 30 Mar 2008 21:34 GMT
Hi Nils
Checking if each file exist in a loop is the only way.

Signature
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
> Ron,
>
[quoted text clipped - 29 lines]
>> >>
>> >> Thanks
Nils Titley - 31 Mar 2008 12:00 GMT
Thanks for the help. I will give it a try. I dont' think it is necessary to
check if they exist but better to check than to get an error and have the
move fail. I don't think it is necessary to check because I don't think
there will be duplicate files.
> Ron,
>
[quoted text clipped - 29 lines]
> > >>
> > >> Thanks