How to copy last updated file into other location by command batch

this scripts copy lastlly updated file from given path into target path.It looks only selected directory it does not look for sub-directory.
just create xxx.bat and call with 2 parameters
usage : xxx.bat source_path target_path
ex: command.bat d:\sil\from d:\sil\to

::Copy Files Made Or Modified Today
@echo off

set y=0
set source=%1
set dest=%2
pushd "%source%"
for /f %%a in ('dir /b /a-d /o-d') do call :PROCESS "%%a"
popd
goto :eof
:PROCESS
if %y%==0 copy %1 "%dest%"
if %y%==0 set y=1

Comments

Popular posts from this blog

Complex Query in QueryExpression in Microsoft CRM 2011

Exception caught instantiating TERADATA report server extension SQL Reporting Services

Microsoft Power Apps Portal integration with Dynamics 365 CE On-Premise - Step By Step Guide