# Solved: XCOPY Unknown Folder



## gorkemyurtcu (Nov 28, 2012)

hello all;

i want to copy a folder to my flash disk with xcopy command but i don't know all of the folder's name how can i command it?

for example my command is below; i want to copy all folders which's name starts with MET

@echo off 
:: variables 
/min 
SET odrive=%odrive:~0,2% 
set backupcmd=xcopy /s /c /d /e /h /i /r /y 
echo off 
%backupcmd% "%USERPROFILE%\Desktop\MET" "%drive%\ABC\Lessons" 
@echo off 
cls

Thanks for your helps


----------



## foxidrive (Oct 20, 2012)

Untested:


```
@echo off
SET odrive=%odrive:~0,2% 
set backupcmd=xcopy /s /c /d /e /h /i /r /y 
for /f "delims=" %%a in ( ' dir /ad /b "%USERPROFILE%\Desktop\MET*" ' ) do (
%backupcmd% "%USERPROFILE%\Desktop\%%a" "%drive%\ABC\Lessons\%%a\"
)
pause
```


----------



## gorkemyurtcu (Nov 28, 2012)

thank you this is working


----------

