« Previous Next »

Thread: VBS MOVE file/folders to a new folder- no idea...

Last post 01-06-2009 9:32 PM by superdog. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 01-05-2009, 9:48 PM

    • superdog
    • Top 500 Contributor
    • Joined on 12-16-2008, 10:49 AM
    • Posts 18

    VBS MOVE file/folders to a new folder- no idea...

    Dear all, I am facing some problem, as I not familiar with vbs.

    My problem: By using the script below, I able to successfully move the whole simon14 folder into c:/testing/simon14


    However, what I want is to move all the FILES n FOLDERS INSIDE simon14 to C:/testing.

    It means I don't want to include this simon14 by itself.

    Help...

     

    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    strSource = "C:/simon14/"

    If Right(strSource, 1) = "/" Then strSource = Left(strSource, Len(strSource) - 1)
    strDest = "C:/testing/"

    If Right(strDest, 1) <> "/" Then strDest = strDest & "/"

    If objFSO.FolderExists(strDest) = False Then
          objFSO.CreateFolder strDest
    End If

    If objFSO.FolderExists(strSource) Then
          objFSO.CopyFolder strSource, strDest, True
          'objFSO.DeleteFolder strSource, True
    End If

    Set objFSO = Nothing

  • 01-06-2009, 9:32 PM In reply to

    • superdog
    • Top 500 Contributor
    • Joined on 12-16-2008, 10:49 AM
    • Posts 18

    Re: VBS MOVE file/folders to a new folder- no idea...

     ok, its now solved. I read all the files and move over, then read all the folders inside it and move over.

     thanks everybody for looking for this post.

Page 1 of 1 (2 items)
Microsoft Communities