See if this helps:
Public Function RecreateFolder(FolderName)
Dim FSo, ofolder
On Error Resume Next
Set FSo = CreateObject("Scripting.FileSystemObject")
If FSo.FolderExists(FolderName) = True Then ' Check if the Folder
Exists
FSo.DeleteFolder(FolderName) ' Delete folder if it exists
Set ofolder = FSo.CreateFolder(FolderName) ' Create folder
Else
Set ofolder = FSo.CreateFolder(FolderName) ' Create folder if it
does not exist
End If
Set ofolder = Nothing
Set FSo = Nothing
On Error Goto 0
End Function
On Wed, Jan 16, 2013 at 10:57 AM, chaman kalra <[email protected]> wrote:
> yes raj
>
>
> On Wed, Jan 16, 2013 at 10:25 AM, RAJ KAMAL <[email protected]>wrote:
>
>> Dear Chaman,
>>
>> So what you mean is we need to create a folder and if there exist a
>> folder with the same name, then it should overwrite with newly created one.
>> So the tasks are create folder and overwrite folder. Right???
>>
>> *-Thanks & Regards,*
>>
>> *RAJ KAMAL*
>> *
>> *
>>
>>
>>
>>
>> On Tue, Jan 15, 2013 at 4:45 PM, chaman kalra <[email protected]>wrote:
>>
>>> Hi Raj,
>>>
>>> Your Code look like if folder exist then copy the file in the
>>> destination folder other wise it will gives message target folder not exist
>>> but my question is if your are created the folder with name "testing "
>>> and the folder exist with same name , then folder should be overwrite
>>>
>>>
>>>
>>> On Tue, Jan 15, 2013 at 10:55 AM, RAJ KAMAL <[email protected]>wrote:
>>>
>>>>
>>>> strFileToCopy = "c:\scripts\test.txt"
>>>> strFolder = "c:\scripts\temp\"
>>>>
>>>> Const OverwriteExisting = TRUESet objFSO =
>>>> CreateObject("Scripting.FileSystemObject")
>>>>
>>>> If objFSO.FolderExists(strFolder) Then
>>>> objFSO.CopyFile strFileToCopy, strFolder, OverwriteExisting Else
>>>> Wscript.Echo "Target Folder does not exist."End If
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *-Thanks & Regards,*
>>>>
>>>> *RAJ KAMAL*
>>>> *
>>>> *
>>>>
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> "QTP - HP Quick Test Professional - Automated Software Testing"
>>>> group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/MercuryQTP?hl=en
>>>>
>>>
>>>
>>>
>>> --
>>> Thanks & Regards
>>> Chaman Kalra
>>> Email :[email protected]
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> "QTP - HP Quick Test Professional - Automated Software Testing"
>>> group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/MercuryQTP?hl=en
>>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/MercuryQTP?hl=en
>>
>
>
>
> --
> Thanks & Regards
> Chaman Kalra
> Email :[email protected]
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en