Copy subfolders that have variable names

Author Message
Vicki05

  • Total Posts : 8
  • Scores: 0
  • Reward points : 0
  • Joined: 1/15/2012
  • Status: offline
Copy subfolders that have variable names Wednesday, January 25, 2012 6:04 AM (permalink)
0
Hi All,
I am having an issue copying sub folders with variable names. With a batch file, I was able to copy sub folders and its contents without any issues by putting a wild card.  How can I do that in vbscripting? The root folder has sub folders that I need to copy and some ini files and exe that I do not want to.
 
Could someone please point me in the right direction.

Any help is appreciated.
 
Vicki
 
#1
    ebgreen

    • Total Posts : 8219
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    Re:Copy subfolders that have variable names Wednesday, January 25, 2012 6:28 AM (permalink)
    0
    Well it will depend in part on how exactly you are trying to do the copy. When you are asking questions, including the pertinent code along with any errors and indicating the specific line that the error refers to will always help.
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      Vicki05

      • Total Posts : 8
      • Scores: 0
      • Reward points : 0
      • Joined: 1/15/2012
      • Status: offline
      Re:Copy subfolders that have variable names Wednesday, January 25, 2012 10:48 AM (permalink)
      0
      HI Ebgreen,
       
      I am new at vbs and have long ways to go.  This is what I have to copy the folder. It copies the root folder plus everything in it when I just need to copy the subfolders. I have been searching on how to copy the subfolders that have variable folder names and had  no luck.
       
      dim filesys
      set filesys=CreateObject("Scripting.FileSystemObject")
      If filesys.FolderExists("C:\Program Files\Tango\") Then
         filesys.CopyFolder "C:\Program Files\Tango", "d:\TEST\"
      End If
       
       
       
      #3
        ebgreen

        • Total Posts : 8219
        • Scores: 98
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        Re:Copy subfolders that have variable names Wednesday, January 25, 2012 3:25 PM (permalink)
        0
        According to the documentation, .CoppyFolder supports wild names. http://msdn.microsoft.com/en-us/library/xbfwysex.aspx
         
        If that does not appear to work for you, the next option is to get the collection of subfolders iterating through it and  explicitly copying each one.
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9