+ 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
    218
    Thank Post
    33
    Thanked 2 Times in 2 Posts
    Rep Power
    9

    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,479
    Thank Post
    108
    Thanked 399 Times in 322 Posts
    Rep Power
    113
    You should be able to do this with Robocopy.

  3. #3

    Join Date
    Feb 2008
    Posts
    218
    Thank Post
    33
    Thanked 2 Times in 2 Posts
    Rep Power
    9

    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
    831
    Thank Post
    432
    Thanked 117 Times in 95 Posts
    Rep Power
    53
    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,327
    Thank Post
    170
    Thanked 233 Times in 107 Posts
    Rep Power
    54
    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
    218
    Thank Post
    33
    Thanked 2 Times in 2 Posts
    Rep Power
    9

    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

    Join Date
    Nov 2007
    Location
    Leeds
    Posts
    263
    Thank Post
    34
    Thanked 40 Times in 36 Posts
    Rep Power
    15
    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 terrorvis from:

    itgeek (4th June 2009)

  11. #8
    SpuffMonkey's Avatar
    Join Date
    Jul 2005
    Posts
    1,827
    Thank Post
    32
    Thanked 175 Times in 112 Posts
    Rep Power
    65
    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
  •