Xcopy source folder name for name

I want to copy from the source lookup folder to the destination folder:

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

Therefore, folders starting with "n" must be copied to the destination.

Any help to get this job would be greatly appreciated.

+4
source share
2 answers
for /f "delims=" %%a in ('dir /b/ad "a:\parentfolder\n*" ') do xcopy "a:\parentfolder\%%a\*" x:\parentfolder\

As you have it, XCOPY assumes it n*is a file specifier, and there is no way to say it differently.

+3
source

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

a:
cd \parentfolder
xcopy /s n*.* x:\parentfolder
0
source

Source: https://habr.com/ru/post/1537444/


All Articles