CGRemakes Posted December 14, 2010 Share Posted December 14, 2010 (edited) I'm attemtpting to figure out the best way to make it so directory B recursively syncs to directory A. It should just be 1 direction, meaning if there is a newer file in directory A than B, it should copy the file from A to B, and if a file has been deleted from directory A, it should be deleted from directory B, and if it's the same, it just skips it. However, it should not work in reverse (B should NEVER determine what happens on A). Doing searches, the first part of copying newer files can be easily accomplished using xcopy. The latter part I have not found a solution for, yet. It needs to be done using only built in tools for either Autoit or Windows XP or newer. The only way I can think to do it is to loop through every file/folder in directory B, and verify it still exists in directory A, and delete it if it doesn't. One nice thing, is the "path" will be the same once you get into the sub-directories. That way, I can just straight compare to see if it exists. I won't have to search or anything. The following is a comparable structure to what I have: directory a: C:\directory1\subdirectory\file1.txt directory b: Z:\backup\directory1\subdirectory\file1.txt I'm open to any solutions as to how to better accomplish this whole proceedure. Thanks! Edited December 14, 2010 by CGRemakes Link to comment Share on other sites More sharing options...
UEZ Posted December 14, 2010 Share Posted December 14, 2010 Use Robocopy!Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
CGRemakes Posted December 14, 2010 Author Share Posted December 14, 2010 Use Robocopy!Br,UEZThe main problem is we manage hundreds of PCs, so that would mean we would have to manually install that external program on ALL the PCs (hence the request for no outside programs we'd have to install). I will keep that in mind, though, should the alternative add a ton of overhead or issues. Link to comment Share on other sites More sharing options...
UEZ Posted December 14, 2010 Share Posted December 14, 2010 (edited) You can embed Robocopy within your script. Have a look to FileInstall(). Btw, how you want to sync with AutoIt exe without installing it? Login script? Br, UEZ Edited December 14, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
CGRemakes Posted December 14, 2010 Author Share Posted December 14, 2010 (edited) You can embed Robocopy within your script. Have a look to FileInstall().Btw, how you want to sync with AutoIt exe without installing it? Login script?Br,UEZAh, cool. I did not know that. Learn something new every day. That will be a very useful feature. Much appreciated! BTW, does that add a fair amount of overhead to do it that way? To answer your second question, we use a program that pushes updates out to the PCs. Not all are managed by this program, so we will have to manually install even the autoit program to those PCs. Yes, we could also push out robocopy to those that are, but it's just 1 more thing to maintain. Edited December 14, 2010 by CGRemakes Link to comment Share on other sites More sharing options...
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