문제

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

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

Only folders starting with "n" should therefore be copied to the destination.

Any help to get this working would be much appreciated.

도움이 되었습니까?

해결책

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.

다른 팁

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

a:
cd \parentfolder
xcopy /s n*.* x:\parentfolder
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top