sparks2000
asked on
i need to write a script to copy backup data to a netwrok share day per day
hi guys,
i want to write a script that copies data from a specific directory in windows to a directory in a network share.and i want the script run daily(could be dne with task scheduler) but i need the copies to be named as the per the the date that it was taken. i hope i was clear in my request.Does anyone have a sample or template that i can use it have this script.thank to you all
i want to write a script that copies data from a specific directory in windows to a directory in a network share.and i want the script run daily(could be dne with task scheduler) but i need the copies to be named as the per the the date that it was taken. i hope i was clear in my request.Does anyone have a sample or template that i can use it have this script.thank to you all
If it was on server 2003 why dont you use robocopy? http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
"xcopy c:\data\* f:\backup\%date:~10,4%_%da
Save this command in notepad & save as backup.bat file.
In this the xcopy commands will copy files and folders. The syntax for the command is xcopy [source] [destination] [arguments]. Where source is the folder that you want to backup and destination is the backup on the network drive. The arguments tell xcopy how to handle certain situations. For my script I used /Y to suppress prompting when overwriting files. If you do not include this the script will ask you before copying each file, that wouldnt be automated. /Q doesnt display the file names while copying. /S copies directories and sub directories. You can find more arguments by opening the command windows and typing xcopy /?.
%date:~10,4%_%date:~4,2%_%
Start>run>ntbackup and use the backup wizard as per your requirement daily/weekly & monthly basis.
Regards,
Vijay kadadi
Regards,
Vijay kadadi
ASKER
dear srawale,
i did not get what are the 4,2%...and all the percentages .any way it did not work, it gave me anneror so i had to remove them.can u send it again please??
i did not get what are the 4,2%...and all the percentages .any way it did not work, it gave me anneror so i had to remove them.can u send it again please??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
when i run the script :xcopy c:\dell\* d:\backup\%date:~10,4%_%da te:~4,2%_% date:~7,2% _backup\* /Y /Q /S
it gave me this message:
Invalid switch - /_00_backup\*
thanks
it gave me this message:
Invalid switch - /_00_backup\*
thanks
xcopy c:\dell\* d:\backup\%date:~10,4%_%da te:~4,2%_% date:~7,2% _backup\* /Y /Q /S
In this script all data of c:\dell folder will copied to d:\backup folder with current year_current month_current date_backup folder in short script will create the destination folder as d:\backup\2008_02_06_backu p.
You cross check the command again. as per my eariler attachment.
Thanks
In this script all data of c:\dell folder will copied to d:\backup folder with current year_current month_current date_backup folder in short script will create the destination folder as d:\backup\2008_02_06_backu
You cross check the command again. as per my eariler attachment.
Thanks