itgeek Posted June 4, 2009 Posted June 4, 2009 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:)
itgeek Posted June 4, 2009 Author Posted June 4, 2009 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??
BatchFile Posted June 4, 2009 Posted June 4, 2009 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!!robocopy.zip 1
ICTNUT Posted June 4, 2009 Posted June 4, 2009 This should do it for you: robocopy.exe [source] [destination] [flags] robocopy.exe /? will giove you the other [flags] that you can use. 1
itgeek Posted June 4, 2009 Author Posted June 4, 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
IrritableTech Posted June 4, 2009 Posted June 4, 2009 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 1
SpuffMonkey Posted June 4, 2009 Posted June 4, 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 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now