teamhypoxia 0 #1 September 23, 2005 got a little problem here at work.... there are multiple files living on a server in our office in another city. I need to frequently copy those files onto either a local server or my hard drive. the files are nested within seperate subfolders and need to be copied to identical seperate subfolders. I am currently doing it by navigating via explorer and "drag and dropping" but this is cumbersome. I'm thinking I need a .bat file or something that I can simply execute to automate this silliness but I have no idea how to write script for a .bat file. can anyone help me out? perhaps with a sample .bat script that I can reverse engineer? or even another suggestion entirely? thanks Quote Share this post Link to post Share on other sites
beowulf 1 #2 September 23, 2005 Use xcopy. With the appropriate settings it will do exactly what you want. Type in xcopy /? to get the help information. example xcopy /E /Z /Y c:\source\* d:\destination This will copy all files and directories including empty directories into the destination. Not exactly what you want but you can modify it to do what you need. Quote Share this post Link to post Share on other sites
StreetScooby 5 #3 September 23, 2005 If you're using NT, you can "schedule" the xcopy command to run at regular intervals. I'm sure you can even do it with a Windows workstation, just not off the top of my head.We are all engines of karma Quote Share this post Link to post Share on other sites
ifall 0 #4 September 23, 2005 Yeah, you can. YEARS ago I had one running on a 98 machine that I had pinging a router every hour 'cause the link would go down after a while if I didn't. Quote Share this post Link to post Share on other sites
teamhypoxia 0 #5 September 23, 2005 QuoteUse xcopy. With the appropriate settings it will do exactly what you want. Type in xcopy /? to get the help information. example xcopy /E /Z /Y c:\source\* d:\destination This will copy all files and directories including empty directories into the destination. Not exactly what you want but you can modify it to do what you need. is this something I can write into a .bat file with all the file paths so that I can simply execute the .bat to automate it? Quote Share this post Link to post Share on other sites
shropshire 0 #6 September 23, 2005 If you dont want to write something yourself... do a GOOGLE for File Replication software, which can do the file transfer stuff for you and schedule the task.. (.)Y(.) Chivalry is not dead; it only sleeps for want of work to do. - Jerome K Jerome Quote Share this post Link to post Share on other sites
SudsyFist 0 #7 September 23, 2005 Scheduled XCOPY works for what it does, but it's not very robust in terms of logging, real-time sync, flexible scheduling, caching, etc. Windows 2000 and 2003 have the kludgy File Replication Service (FRS), which requires Active Directory for use. Other COTS options range from lower-end products like Second Copy to Legato's line of enterprise replication software (Replistor, DiskXtender, etc.). Depending on business need and budget, you may wish to look down that path, as well. Quote Share this post Link to post Share on other sites
StreetScooby 5 #8 September 23, 2005 Yes, you can put this in a bat file with hardcoded paths. Just beware that if someone is using the file while it's being copied, problems could come up (file's get locked by O/S, or the copies aren't actually in sync like you thought). Unless many people are using the files alot, I wouldn't worry about it. If you are using the files alot, maybe should look into putting the data in a relational database (MS SQL Server, etc.).We are all engines of karma Quote Share this post Link to post Share on other sites
flyangel2 2 #9 September 23, 2005 Geek talk is so hot!May your trails be crooked, winding, lonesome, dangerous, leading to the most amazing view. May your mountains rise into and above the clouds. - Edward Abbey Quote Share this post Link to post Share on other sites
beowulf 1 #10 September 23, 2005 Like Streetscooby said you sure can put this in .bat file. Quote Share this post Link to post Share on other sites
teamhypoxia 0 #11 September 23, 2005 ok... almost have a working .bat first problem was spaces in the names of the folders fixed that using "_" now my problem is "&" in the names of a couple of folders not sure how to fix this one any hints? Quote Share this post Link to post Share on other sites
beowulf 1 #12 September 23, 2005 it makes life easier if you avoid using too many special charactersis this how you are using the quotations? example "c:\documents and settings\administrator" Quote Share this post Link to post Share on other sites
teamhypoxia 0 #13 September 23, 2005 not using the quotations in the file at all... just on here here's one line of it: xcopy /D /Z /Y K:\Memorial_North_Hospital\Constructs\Plumbing_&_Piping\Med_Gas\00MG.dwg C:\Documents_and_Settings\ericj.HPE\Desktop\Memorial_North_Hospital\Constructs\Plumbing_&_Piping\Med_Gas\00MG.dwg & can't be helped at this point Quote Share this post Link to post Share on other sites
StreetScooby 5 #14 September 23, 2005 Quote it makes life easier if you avoid using too many special characters So true. Also, if you're copying from a windows machine to unix machine you're filenames become case sensitive. Just a potential gotcha, FYI.We are all engines of karma Quote Share this post Link to post Share on other sites
StreetScooby 5 #15 September 23, 2005 What's the error message?We are all engines of karma Quote Share this post Link to post Share on other sites
beowulf 1 #16 September 23, 2005 oh use the quotations to deal with the special characters. The quotations will allow you to copy files and directories with spaces. For some reason I looked at "_" and saw quotations only. It's been a long day. example xcopy /D /Z /Y "K:\Memorial_North_Hospital\Constructs\Plumbing_&_Piping\Med_Gas\00MG.dwg" "C:\Documents_and_Settings\ericj.HPE\Desktop\Memorial_North_Hospital\Constructs\Plumbing_&_Piping\Med_Gas\00MG.dwg" Quote Share this post Link to post Share on other sites
teamhypoxia 0 #17 September 23, 2005 Beautiful! got it done now if we could just get someone with a brain to replace our outsourced it department and get them to fix our network.... oh and Mary.. I'm not really much of a computer geek, but I play one at work Quote Share this post Link to post Share on other sites
flyangel2 2 #18 September 23, 2005 Quote I'm not really much of a computer geek, but I play one at work I thought you were a plumber. I wanted to see your butt crackMay your trails be crooked, winding, lonesome, dangerous, leading to the most amazing view. May your mountains rise into and above the clouds. - Edward Abbey Quote Share this post Link to post Share on other sites