I'm trying to write a batch script that will copy the latest file created in a directory that is larger than 700MB. I require the file size because I don't want to copy a file that is currently being created, thus is smaller than a typical backup file.
Would someone be able to modify the script below to include the >700MB requirement?
Thanks!
:: Erase the content of the "sql_individual_backup" directory
cd "C:\Backup\sql_individual_backup"
del *.* /Q
:: Start to copy over the most recent file
@echo off
set "source=C:\Backup\sql_hourly"
set "dest=C:\Backup\sql_individual_backup"
pushd "%source%" ||(
echo.Source does not exist&pause&goto EOF)
for /f "tokens=*" %%f in (
'dir /A-D /OD /B') Do set "file=%%f"
popd
xcopy /d /i "%source%\%file%" "%dest%\"
:: Close the command prompt window
exit 0