Wednesday, 19 October 2011

QTP Script: Move a local or network folder

 

' =============================================================
' function: FolderMove
' desc : Moves a folder and all of its files to a new path
' params : strSourceFolder - the folder to copy
' strDestinationFolder - the location to copy to
' returns : void
' =============================================================

Function FolderMove(strSourceFolder, strDestinationFolder)

 

Dim objFS

 

' create a file system object
Set objFS = CreateObject("Scripting.FileSystemObject")

 

' check that the source folder exists
If Not objFS.FolderExists(strSourceFolder) Then

 

    ' fail if the source does not exist
    reporter.ReportEvent micFail, "Move Folder""Source Folder '"& strSourceFolder &"' Does Not Exist"

 

Else

 

    ' check that the destination folder doesn't already exist
    If Not objFS.FolderExists(strDestinationFolder) Then

        ' move the folder
        objFS.MoveFolder strSourceFolder, strDestinationFolder

 

    Else

 

        ' fail if the target folder was already in place
        reporter.ReportEvent micFail, "Move Folder""Unable to Move Folder as the Target '" & strDestinationFolder & "' Already Exists"

    End If

End If

 

' destroy the object
Set objFS = Nothing

End Function 'FolderMove

 

9 comments:

  1. Thank you for the good writeup. It in fact was a amusement account it.
    Look advanced to more added agreeable from you!
    By the way, how could we communicate?

    my blog post :: minecraft download

    ReplyDelete
  2. First off I would like to say excellent blog!
    I had a quick question which I'd like to ask if you don't mind.
    I was interested to find out how you center yourself and clear your mind prior
    to writing. I've had difficulty clearing my thoughts in getting my thoughts out
    there. I truly do take pleasure in writing however it just seems like the first 10 to 15 minutes are wasted just trying to
    figure out how to begin. Any suggestions or tips? Thank you!


    Look into my site Quest Bars Free Sample

    ReplyDelete
  3. I was suggested this blog by my cousin. I am not sure whether this post is written by him as no
    one else know such detailed about my difficulty. You are wonderful!
    Thanks!

    Feel free to visit my web page nutrition bars

    ReplyDelete
  4. I will immediately snatch your rss as I can't find your email subscription hyperlink or newsletter service.

    Do you have any? Please allow me know in order that I may
    subscribe. Thanks.

    Here is my website :: here quest bars link

    ReplyDelete
  5. Appreciating the hard work you put into your website and detailed information you offer.

    It's great to come across a blog every once in a while that isn't the same out of date rehashed information.
    Excellent read! I've bookmarked your site and I'm including your RSS feeds to my Google account.



    Review my web blog: Quest Bars

    ReplyDelete
  6. Great post.

    my homepage :: quest bars

    ReplyDelete
  7. My programmer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the
    expenses. But he's tryiong none the less. I've been using Movable-type on several websites for about a year and am anxious about switching to another platform.
    I have heard excellent things about blogengine.net.

    Is there a way I can import all my wordpress posts into it?
    Any kind of help would be really appreciated!

    My homepage :: Diet Plans to Lose Weight

    ReplyDelete
  8. Thanks for ones marvelous posting! I definitely enjoyed reading it, you will be a great author.
    I will always bookmark your blog and will often come back
    very soon. I want to encourage you to ultimately continue your great posts,
    have a nice afternoon!

    Feel free to surf to my blog - Diet Plans for Women

    ReplyDelete
  9. Hi there, just became aware of your blog through Google, and
    found that it's really informative. I am gonna watch out for brussels.
    I will appreciate if you continue this in future. A lot of people will be benefited from your
    writing. Cheers!

    Feel free to surf to my weblog - coconut oil hair

    ReplyDelete