I have no experience at all with writing any batch files or anything but looking to create one to do automatic backups for certain files from one host to a shared drive. So if anyone can help me create this script I would really appreciate it.
So what I need is a script that will run a batch file on a local computer that is on a network that will copy a folder from its C:\ called "GDATA" and then will paste this file on a shared drive called \\hstn16\color$\Color Computer Backup
The only catch is that it needs to create a new folder in the desired location with the name of that computer it is copying the file from and then paste it withing that directory.
For example if the computer name is "abcd"
So GDATA folder needs to go from Computer "abcd" C:\GDATA to \\hstn16\color$\Color Computer Backup\abcd\GDATA <------ this abcd folder needs to be created within the script though. Also there needs to be a command if there is already an "abcd" folder created in \\hstn16\color$\Color Computer Backup then it just needs to just paste it within that folder that was created before.
Hope this makes sense and it is possible. Thanks.
Need a small help
Moderator: DosItHelp
Re: Need a small help
Code: Select all
@echo off
xcopy "C:\GDATA\*.*" "\\hstn16\color$\Color Computer Backup\%computername%\GDATA\"
Re: Need a small help
Will this create that folder with the computer name ....if it does not see it in that directory?
Re: Need a small help
Yes, xcopy will create the path, and just copy if it already exists.