Jump to content

Recommended Posts

Posted

Hello all,

 

New Post here. I have a batch file im trying to get to work on Server 2008 R2.

 

:: --- BATCH SCRIPT START ---
:: --- Batch File to Copy and create new folder for Photo Backup's ---
:: --- Created By: Me --- 
@[u][url="http://www.edugeek.net/member.php?u=16971"]echo[/url][/u] off
setlocal enabledelayedexpansion
for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set target=D:\Photos\%%C-%%B-%%A-Photos Backup
xcopy "D:\Photos\*" "%target%\" /E /-Y
setlocal
set source=D:\Photos
pushd "%source%"
FOR /F "skip=3 delims=" %%a IN ('DIR /B /AD 20?????? ^| SORT /R') DO RD /S /Q "%%a"
popd
endlocal
:: --- BATCH SCRIPT END ---

 

What this does is it should Copy the Photos Folder and everything inside it and copys is to the same directory in D with attributes and a ending.

After the 3rd Copy it deleted the first to make a new on...there should always be 3 copies that run daily.

 

Any help would be appreciated.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...