Batch File : FOR /R + Robocopy Issue

March 21, 2011 at 20:38:00
Specs: Windows 7
I need a little help getting robocopy to work with the FOR command.

Here is my original code using xcopy. (Using Test.bmp for test purpose in this example)

FOR /R E:\ %%V IN ("Test.b*p") DO xcopy "%%V" E:\

The above code does exacly what I want, scan multiple folders and subs for a specific file.

I want to use Robocopy so the user can see the progress of the transfer and use the other features that xcopy does not have.

Can someone help me to convert this to something that will work with Robocopy?

I know that FOR /R E:\ %%V IN ("Test.b*p") DO robocopy "%%V" E:\ will not work because %%V is the entire path + file name and robocopy what those seperate.

Any help will be great.

See More: Batch File : FOR /R + Robocopy Issue

Report •

March 22, 2011 at 05:46:06
Untested and needs refinement, but I need coffee:
FOR /D /R E:\ %%V IN (.) DO robocopy "%%V" E:\ "Test.b*p" 2>NUL

How To Ask Questions The Smart Way

Report •

March 23, 2011 at 18:00:11
1st off, thanks for your help razor.

Combining my other thread and this one, here is where I am at.

for %%a in (w X y z) do if exist \\Storage\%%a\%username% set someDir=\\Storage\%%a\%username%
@echo %someDir%

set Video=
set /P Video= Enter Video Filename: %=%
if "%Video%"=="" goto input
echo Video File: %Video%
FOR /D /R %someDir% %%V IN (.) DO robocopy.exe "%%V" E:\ "%Video%*" 2>NUL

Seems to be working ...

Report •

Related Solutions

Ask Question