You should be able to do this with Robocopy.
Hi I need a script to copy everything in one folder to another server, if the file is already on the destination I want it not to copy. Is this possible![]()
You should be able to do this with Robocopy.
Thanks I have kust figured this out will the following work
ROBOCOPY \\Server1\reports \\Server2\backup *.doc /S
Where do I need to put robocopy or is it built into windows??
what you need isn't xcopy, but robocopy.exe (yes, really!) a copy is attached.
I've attached it to this message - just unzip and stick it in your Windows folder so the Path points to it then from a command prompt type "robocopy /?" to get all the parameters, of which there are many!
use "/mir" with extreme care, it's particularly powerful but potentially destructive!!![]()
itgeek (04-06-2009)
This should do it for you:
robocopy.exe [source] [destination] [flags]
robocopy.exe /? will giove you the other [flags] that you can use.
itgeek (04-06-2009)
Thanks
I will download and have a play.
Just one more question?
If I wanted to delete files in a folder more that 5 days old, does any no how to do this?
Thanks
I found this VBS script somewhere on the net, and use it to delete files more than 30 days. Just edit the path and days (calcresult)...
Dim i, fso, f, f1, sf, BasePath, CalcResult, fNameArray()
BasePath = "T:\Docs Backups\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(BasePath)
Set sf = f.SubFolders
For Each f1 in sf
CalcResult = DateDiff("d",f1.DateCreated,Now)
if CalcResult > 30 then
ReDim preserve fNameArray(i)
fNameArray(i) = f1.Name
i = i + 1
end if
Next
For Each fName in fNameArray
FSO.DeleteFolder(BasePath & "\" & fName)
Next
itgeek (04-06-2009)
You could also use RichCopy - robocopy's replacement from here
It does the same, has a GUI as well as command line and is multi-threaded - so should be quicker
TonyRidal (05-06-2009)
There are currently 1 users browsing this thread. (0 members and 1 guests)