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

  • Question

  • User1795084881 posted

    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.



    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

    Monday, January 5, 2009 9:48 PM


  • User1795084881 posted

     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.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, January 6, 2009 9:32 PM