Hi Team,
I need a batch script to take auto back up of important files with the scheduled time from the server to the local machine and the details given below. the folder should be copied with the name of current date. Please assist me at the earliest. Thanks.
destination - \\10.99.2.222\reports (server example)
where to copy = D:\reports
Note: the batch file should not recommend me to press any key to take back up of files.
need batch file to take auto back up important files.
Moderator: DosItHelp
Re: need batch file to take auto back up important files.
Do you have access to this share without logging in?
Re: need batch file to take auto back up important files.
yes i have option to access the server without logging in...
Re: need batch file to take auto back up important files.
This should copy \\10.99.2.222\reports to D:\reports\date-time
It is untested:
It is untested:
Code: Select all
@echo off
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%"
set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"
robocopy "\\10.99.2.222\reports" "D:\reports\%fullstamp%" /mir
Re: need batch file to take auto back up important files.
I tried by copying the above code to text file and saved it to batch file, i run the batch file manually but the files are not copied. please check and advise. Thanks
Re: need batch file to take auto back up important files.
Try the code above now. I removed the /zb from the end which generated an error to do with rights/permissions here.
Re: need batch file to take auto back up important files.
Thank u very much it worked wellllllll............