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

Assembly Microsoft.Dynamics.Service.Plugins.dll can not be loaded. Dynamics CRM 365 Engine version 9 - CRM User creation error

Exception caught instantiating TERADATA report server extension SQL Reporting Services

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