I'm taking a backup of source directory daily with only updated files will be copied to destination.
Now I want to create a folder on date wise and copy only modified file on that date to that folder including directory structure and no other files from source.
I try this
@echo off
set date="%date%"
set source1=\\files\source\
set destination1=C:\Users\user\Desktop\File_Backup1\Destination\
set dest = C:\Users\user\Desktop\File_Backup1\%date%\
for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd1=%%j"."%%i"."%%k
if exist %destination1% goto GO
:GO
xcopy %source1%* %destination1% /s/d/y/c/v/r
echo.
echo Finished copying %source1% to %destination1%
echo.
echo Created %destination1%%yyyymmdd1%
for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set yyyymmdd1=%%j"."%%i"."%%k
if exist %destination1% goto GO
:GO
mkdir "dest"
xcopy "%source1%*" "C:\Users\user\Desktop\File_Backup1\%date%\" /t
pause
Now Files copied, date folder created with all directory structure but no updated file.
Comments
Post a Comment