Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Scripts If you need or have any scripts then get 'em here.

Go Back   EduGeek.net Forums > Coding and Web Development > Scripts
Reply
 
LinkBack Thread Tools Search Thread
Sponsored Links
Old 04-06-2009, 08:49 AM   #1
 
itgeek's Avatar
 
Join Date: Feb 2008
Posts: 53
uk
Thanks: 16
Thanked 1 Time in 1 Post
Rep Power: 0 itgeek is an unknown quantity at this point
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
  Reply With Quote
Old 04-06-2009, 08:53 AM   #2
 
K.C.Leblanc's Avatar
 
Join Date: Jul 2007
Location: Rural heck
Posts: 1,387
uk
Thanks: 46
Thanked 144 Times in 120 Posts
Rep Power: 47 K.C.Leblanc has much to be proud of K.C.Leblanc has much to be proud of K.C.Leblanc has much to be proud of K.C.Leblanc has much to be proud of K.C.Leblanc has much to be proud of K.C.Leblanc has much to be proud of K.C.Leblanc has much to be proud of K.C.Leblanc has much to be proud of K.C.Leblanc has much to be proud of
Default

You should be able to do this with Robocopy.
  Reply With Quote
Old 04-06-2009, 08:56 AM   #3
 
itgeek's Avatar
 
Join Date: Feb 2008
Posts: 53
uk
Thanks: 16
Thanked 1 Time in 1 Post
Rep Power: 0 itgeek is an unknown quantity at this point
Default 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??
  Reply With Quote
Old 04-06-2009, 08:58 AM   #4
 
TonyRidal's Avatar
 
Join Date: Aug 2007
Location: South Cumbria
Posts: 339
uk uk yorkshire
Thanks: 110
Thanked 36 Times in 34 Posts
Rep Power: 15 TonyRidal is a jewel in the rough TonyRidal is a jewel in the rough TonyRidal is a jewel in the rough
Default

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
File Type: zip robocopy.zip (32.3 KB, 4 views)
  Reply With Quote
Thanks to TonyRidal from:
itgeek (04-06-2009)
Old 04-06-2009, 08:59 AM   #5
 
ICTNUT's Avatar
 
Join Date: Jul 2005
Location: Hereford
Posts: 1,052
uk uk wales
Thanks: 103
Thanked 167 Times in 58 Posts
Rep Power: 39 ICTNUT is a splendid one to behold ICTNUT is a splendid one to behold ICTNUT is a splendid one to behold ICTNUT is a splendid one to behold ICTNUT is a splendid one to behold ICTNUT is a splendid one to behold ICTNUT is a splendid one to behold
Default

This should do it for you:

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

robocopy.exe /? will giove you the other [flags] that you can use.
  Reply With Quote
Thanks to ICTNUT from:
itgeek (04-06-2009)
Old 04-06-2009, 09:06 AM   #6
 
itgeek's Avatar
 
Join Date: Feb 2008
Posts: 53
uk
Thanks: 16
Thanked 1 Time in 1 Post
Rep Power: 0 itgeek is an unknown quantity at this point
Default 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
  Reply With Quote
Old 04-06-2009, 09:39 AM   #7
 
terrorvis's Avatar
 
Join Date: Nov 2007
Location: Leeds
Posts: 195
uk
Thanks: 21
Thanked 28 Times in 27 Posts
Rep Power: 9 terrorvis will become famous soon enough terrorvis will become famous soon enough
Default

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)...
Quote:
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
  Reply With Quote
Thanks to terrorvis from:
itgeek (04-06-2009)
Old 04-06-2009, 10:29 AM   #8
 
SpuffMonkey's Avatar
 
Join Date: Jul 2005
Posts: 1,299
uk
Thanks: 14
Thanked 57 Times in 44 Posts
Rep Power: 24 SpuffMonkey is just really nice SpuffMonkey is just really nice SpuffMonkey is just really nice SpuffMonkey is just really nice
Default

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
  Reply With Quote
Thanks to SpuffMonkey from:
TonyRidal (05-06-2009)
Reply

EduGeek.net Forums > Coding and Web Development > Scripts

Similar Threads
Thread Thread Starter Forum Replies Last Post
samba, acls, xcopy CyberNerd *nix 1 30-05-2007 02:50 PM


Tags
.bat , scripts , sims.net , xcopy


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:17 PM.
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Copyright EduGeek.net




website uptime

© 2005 - 2009 EduGeek.net
SERVER: 4
no new posts