Jump to content

Recommended Posts

Posted
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:)
Posted

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??

Posted

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!!:D

robocopy.zip

  • Thanks 1
Posted

This should do it for you:

 

robocopy.exe [source] [destination] [flags]

 

robocopy.exe /? will giove you the other [flags] that you can use.

  • Thanks 1
Posted

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

Posted

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

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...