xcopy wildcard source folder name to destination

前端 未结 2 1007
离开以前
离开以前 2020-12-18 04:05

I want to copy from a wildcard source folder to a destination folder:

xcopy a:\\parentfolder\\n* x:\\parentfolder

Only folders starting wit

相关标签:
2条回答
  • 2020-12-18 04:40

    If you first CD to the folder you want to copy it will work:

    a:
    cd \parentfolder
    xcopy /s n*.* x:\parentfolder
    
    0 讨论(0)
  • 2020-12-18 04:45
    for /f "delims=" %%a in ('dir /b/ad "a:\parentfolder\n*" ') do xcopy "a:\parentfolder\%%a\*" x:\parentfolder\
    

    As you have it, XCOPY assumes that n* is a filespec, and there's no way to tell it otherwise.

    0 讨论(0)
提交回复
热议问题