@echo off
:: Obtains the date
for /f "tokens=2 delims==" %%i in ('wmic os get localdatetime /value') do set datetime=%%i
set date=%datetime:~0,8%
:: Deletes files older than 7 days from the network path
pushd \\fileserver\IT\BCK_DESIGO\DesigoCC\DATA
forfiles /D -7 /S /C "cmd /c if @isdir==FALSE del @path"
popd
:: Move and rename the file to the network destination
forfiles /P D:\BACKUP /M *.bak /D +0 /C "cmd /c robocopy D:\BACKUP \\fileserver\IT\BCK_DESIGO\DesigoCC\DATA @file /MOV & ren \\fileserver\IT\BCK_DESIGO\DesigoCC\DATA\@file @fname_%date%.bak"