todarsey Posted March 18, 2009 Share Posted March 18, 2009 I have been trying to figure this one out and I have looked all over the place and can't find a solution to this.Let's say I have several different folders in C:\images. The folders in this directory are as followsSR23SR23 2006SR54SR54 2006US98US98 2006Is there a way to write a batch file with wild cards to only copy the folders that have the 2006 in the folder name using xcopy? Link to comment Share on other sites More sharing options...
gunsmokingman Posted March 18, 2009 Share Posted March 18, 2009 I am not to good with the cmd promt but try this vbs script.Save As Copy2006Folders.vbsDim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> This Makes The Folder Where The Script Is Located The Parent FolderDim Col :Set Col = Fso.GetFolder(".")'-> Example Using A Full Path ' Dim Col :Set Col = Fso.GetFolder("C:\TheFolder")Dim Obj, CopyTo'-> Place The Path To Where You Want To Copy To Here.CopyTo = "PATH_TO_COPY_TO" For Each Obj In Col.SubFolders If InStr(Obj.Path,"2006") Then Fso.CopyFolder Obj.Path, CopyTo, true End If NextPlace this script in the folder you want to do the copy or you can add a full path.'-> This Makes The Folder Where The Script Is Located The Parent FolderDim Col :Set Col = Fso.GetFolder(".")'-> Example Using A Full Path ' Dim Col :Set Col = Fso.GetFolder("C:\TheFolder")Then fill in the CopyTo varibleCopyTo = "PATH_TO_COPY_TO" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now