# fastest way to copy files from today's date to a dir [DOS batch file]



## MKANET (Mar 21, 2012)

I was able to make a batch file that copies files from today's date (from a pre-specified directory) to another pre-specified directory using the below code. Unfortunately, it takes too long to run against a mapped network drive. So, I have to find a more efficient way to do this. I'm hoping someone can find a clever way to speed things up; without depending on 3rd party command-line tools (unless absolutely necessary). I don't mind how it's done; as long as it's compatible with a Vista/Win7 command prompt. Any help would be greatly appreciated.


```
::Copy Files Made Or Modified Today
@echo off
setlocal
set source=c:\src
set dest=c:\dest
pushd "%source%"
set t=%date:~4%
for /f %%a in ('dir /b /a-d /o-d') do call :PROCESS "%%a"
goto :eof
popd

:PROCESS
for /f %%j in ('echo %~t1') do set d=%%j
if "%d%"=="%t%" copy %1 "%dest%"
goto :eof
```


----------



## MKANET (Mar 21, 2012)

Duh...

I didn't know about the xcopy /d switch:


```
@echo off

set source=C:\Users\Michael\Desktop\Logs\Logs
set destination=C:\temp

for /f "tokens=2" %%a in ('"echo %date%"') do ( set "CURDATE=%%a" )

xcopy /d:%curdate% %source%\*.* %source%\temp
```


----------

