How to copy folders using wildcards

Page 1 of 2 12 LastLast

  1. Posts : 8
    windows 7 ultimate 64 bit
       #1

    How to copy folders using wildcards


    i need to copy folders from one network drive to another drive each night. The structure of the folders are


    10a
    10b
    10c
    11a
    11b
    11c
    12a
    12b
    12c

    i only want to copy the folders starting with 12, there will be a random amount of folders created starting with 12 by the end of the year it could be up to 20 folders all starting with 12, i need to use a wildcard so i don't miss any of them. i would like to put the correct process in a batch file if possible but if not i can run each night manually

    i can't seem to get this to work with copy , xcopy or robocopy

    copy p:\client\12*. z:\clientbak\12*. /s this is an example of what i would like to do with whatever

    copy program and with the correct syntax the above doesn't work with xcopy , copy or robocopy
      My Computer


  2. Posts : 1,800
    Windows 7 Pro x64 SP1
       #2

    Welcome Dsikirica to the windows 7 forum.
    I suggest xcopy with the wildcard xcopy p:\client\12*.* z:\clientbak /s/i/m should copy the files you need
    to the clientbak directory, creating the new directories if you wish.

    Rich
      My Computer


  3. Posts : 8
    windows 7 ultimate 64 bit
    Thread Starter
       #3

    thanks for replying: it said 0 files copied, it doesn't copy anything, i put a new file in one of the 12 folders to test it
      My Computer


  4. Posts : 1,800
    Windows 7 Pro x64 SP1
       #4

    Dsikirica, you are running the command prompt with administrators privs aren't you?

    Rich
      My Computer


  5. Posts : 8
    windows 7 ultimate 64 bit
    Thread Starter
       #5

    I know i had tried that, but it didn't seem to make a difference, so i tried it again making sure i was running it as administrator, it didn't work but it said invalid drive specification this time before 0 files copied

    if i use dir instead of xcopy on the source it shows the folders just fine
    if i use dir on the destination directory it shows that just fine also

    not sure if that is a good test or not, but i didn't get an invalid drive specification
      My Computer


  6. Posts : 1,800
    Windows 7 Pro x64 SP1
       #6

    Dsikirica, copy and paste your exact batch command into a message, an invalid drive specification error might be because of misformed batch command.

    Rich
      My Computer


  7. Posts : 8
    windows 7 ultimate 64 bit
    Thread Starter
       #7

    xcopy p:\client\12*.* z:\clientbak\ /s /i /m
      My Computer


  8. Posts : 3,300
    Win7 Home Premium 64x
       #8

    It might be because you are using a mapped drive. I would suggest trying on your c: drive to make sure the syntax works ok. copy from one location on C to another location on C, then try from P: to C: and then C: to Z:

    You might see where the issue is occuring.
      My Computer


  9. Posts : 8
    windows 7 ultimate 64 bit
    Thread Starter
       #9

    this is so frustrating, thanks for your help so far i really appreciate it

    i copied the whole structure down to my c drive and tried to xcopy it to another local drvie G:

    0 files copied

    dir works with both ends of the xcopy command

    maybe it's a windows 7 problem, i will try on an xp machine and let you know how that works, not sure that matters but worth a try
      My Computer


  10. Posts : 1
    Windows 8
       #10

    xcopy p:\client\12*.* z:\clientbak\ /e /i /m
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:04.
Find Us