PDA

View Full Version : How to notify the end of a copy


somos
08-Nov-2011, 09:05 AM
Hello all,

my company has been using for some time BC3 to synchronize our builds between the different sites the company have. Now I need to execute some operations when the copy is done.

I have a filesystem monitor checking when there are new files being copied but as the copy is slow I need to know when the copy has finished so I can start my own process.

I think one easy way to do that would be to create/copy a special file that signals that all the others have been copied. Not sure if this can be accomplished with the tool. Note that I don't have write access to the source of the filer nor I can put at the source the special file, it should be created or taken from elsewhere.

Do you know if this can be done or another way to accomplish this?

Thanks in advance.

Aaron
08-Nov-2011, 09:35 AM
Hello,

One common strategy for this is to build BC3 into the automated process. As the process runs sequentially through its steps, it will call BC3, BC3 performs the copy, and then moves on to the next step.

If your automated process itself is not sequential, you can use it to call a bat file, which is. You can make a bat file that surrounds both parts of this as well, such as a automated.bat that contains:
bcompare.exe "@script.txt"
yourstep.bat

Alternatively, you could use the BCScript Log command at the bottom of the script to generate a "log" text file that you could check for, if that is easier for you.

somos
08-Nov-2011, 09:53 AM
Thanks for your fast response!

Unfortunately I'm not part of the build team so I cannot modify how the build is done, so the first idea is not an option.

About the second one, it looks pretty good because currently BC is called from a bat file so I will only need to modify it. The thing is that I need to now the folder that has been copied (sync) with BC to place there the control file. Is there a way to let bcompare inform to the bat file which folder(s) has been sync?

The third option looks good to if we can fix the name of the log and we can put the log at the folder that has been sync. Is that possible?

Again, thanks for your help.

Aaron
09-Nov-2011, 08:40 AM
Hello,

I'm not sure about option 2, but BCscript can accept arguments. If you already know your folder, you can pass it in as an argument to both steps:

bcompare.exe "@c:\script.txt" "c:\folder"

then in the script, you can reference the text c:\folder and use it to perform your actions or generate a log, with %1.

The same steps can be used with "logname1" to provide a custom log file name.

somos
09-Nov-2011, 08:48 AM
All that I know before executing the application is that all the options are:

a) There is just one new folder to sync.
b) There is nothing new.

Unfortunately I don't know the name of the folder (that's why we use BC instead of a normal copy) so I really need that BC notify me about which folder has been updated (maybe thru an environment variable or writing the name on a file or something like that ...)

Aaron
09-Nov-2011, 01:16 PM
Hello,

You could generate a report, and parse that report for the new folder or files. You could use the Show Orphans option. I would recommend determining which report type and configuration you want to use in the graphical interface. Once you know which report, we can then help with the script options (for the folder-report command) that would also generate that same report.