+ Post New Thread
Results 1 to 8 of 8
Scripts Thread, Xcopy in Coding and Web Development; Hi I need a script to copy everything in one folder to another server, if the file is already on ...
  1. #1

    Join Date
    Feb 2008
    Posts
    314
    Thank Post
    51
    Thanked 2 Times in 2 Posts
    Rep Power
    13

    Smile Xcopy

    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

  2. #2


    Join Date
    Jul 2007
    Location
    Rural heck
    Posts
    2,662
    Thank Post
    120
    Thanked 434 Times in 353 Posts
    Rep Power
    125
    You should be able to do this with Robocopy.

  3. #3

    Join Date
    Feb 2008
    Posts
    314
    Thank Post
    51
    Thanked 2 Times in 2 Posts
    Rep Power
    13

    Thanks

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

  4. #4
    BatchFile's Avatar
    Join Date
    Aug 2007
    Location
    Cumbria
    Posts
    948
    Thank Post
    542
    Thanked 128 Times in 106 Posts
    Rep Power
    59
    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!!
    Attached Files Attached Files

  5. Thanks to BatchFile from:

    itgeek (4th June 2009)

  6. #5
    ICTNUT's Avatar
    Join Date
    Jul 2005
    Location
    Hereford
    Posts
    1,414
    Thank Post
    193
    Thanked 247 Times in 120 Posts
    Rep Power
    61
    This should do it for you:

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

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

  7. Thanks to ICTNUT from:

    itgeek (4th June 2009)

  8. #6

    Join Date
    Feb 2008
    Posts
    314
    Thank Post
    51
    Thanked 2 Times in 2 Posts
    Rep Power
    13

    Thanks

    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

  9. #7
    IrritableTech's Avatar
    Join Date
    Nov 2007
    Location
    Yorkshire
    Posts
    707
    Thank Post
    71
    Thanked 145 Times in 116 Posts
    Rep Power
    58
    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

  10. Thanks to IrritableTech from:

    itgeek (4th June 2009)

  11. #8

    SpuffMonkey's Avatar
    Join Date
    Jul 2005
    Posts
    2,192
    Thank Post
    52
    Thanked 270 Times in 178 Posts
    Rep Power
    131
    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

  12. Thanks to SpuffMonkey from:

    BatchFile (5th June 2009)

SHARE:
+ Post New Thread

Similar Threads

  1. samba, acls, xcopy
    By CyberNerd in forum *nix
    Replies: 1
    Last Post: 30th May 2007, 02:50 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •