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

New Journey : Linux in Windows and containerization through Docker Desktop for Windows

Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified at Configuration class initiation in CrmServiceHelper.cv

Installation of Microsoft Visual C++ Runtime failed. Exit code: 5100. Result: Asia in Microsoft Dynamics CRM 2011