![]()
[<<]Message[>>] [<<]Author[>>] Subject [<<]Thread[>>]
Number : 3170 Date : 2002-12-02 Author : Kan Yabumoto Subject : Re: One out of date file triggers copying of whole Size(KB) : 2
Brian: I don't think you can do it in one breath for this problem. But, using a batch file and testing XXCOPY's exit code with an IF ERRORLEVEL, you should be able to do this. The key is the behavior of XXCOPY's /L (list-only) operation which reports either a successful operation (finding at least one matched file in a criteria == returns 0) or an unsuccessful one (100 --- No-files-were-found). mybatch.bat ----------------------------------------------- xxcopy \dir_a1\ \dir_a2\ /u/bx/L if not errorlevel goto doit xxcopy \dir_b1\ \dir_b2\ /u/bx/L if not errorlevel goto doit goto end :doit (do what you want here) :end ---------------------------------------------- Note the funny characteristics of the polarity of the test operations here. When the /U/BX/L operation find at least one pair of files that meet the condition that is, /U // only the files that are common in both dirs /BX // list only the cases where the dates are different /L // list-only (no copying) When at least one such a file is found, XXCOPY will return the exit code of 0, else, return 100. So, the action will be triggered when you find 0 in any of the series of similar tests (I showed only two). If brand new files (the files present in the source without their counterpart in the second directory) are also counted in your case, then, don't use the /U switch which explicitly eliminates such files from being counted. Since all you need is one such case, you may add /QF1 which will terminate at the first instances of the case to speed up the test. If the multiple directories you are referring to are subdirectories within one directory, you may add /S. Kan Yabumoto =========================================================== At 2002-12-02 03:20, you wrote: >At present I copy out of date files from a plurality of directories to >backup directories - and at present I copy only those files that are out >of date. However, whenever an out of date file is found I would like to >copy the entire directory that contains the out of date file and not >just the out of date file itself. So far I have been unable to achieve >this aim and any help or suggestions would be greatly appreciated. > >Brian
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.