Page 1 of 1

robocopy in post-build events

Posted: Thu Mar 16, 2017 8:18 am
by kgdyall
I've been using post-build events to copy files into the Flare output (HTML5). The copy command works fine (and yes, I do use quotes around the file name). I have been working on copying our legal notices into the output, as I don't want to index them. This involves copying a few files and a folder of resources. I initially tried xcopy, but that's deprecated, and the /EXCLUDE flag didn't seem to work. So I tried Robocopy, but nothing happened when I did - it failed silently. Tech Support had nothing they could tell me about why it failed, so maybe someone out there can. Here's the command:

Robocopy "$(ProjectDirectory)\legal" "$(OutputDirectory)" /S /XF "*.docx"

I tried several variations: using the full path to Robocopy, changing case, leaving out the /XF option. The robocopy command works fine if I execute it in a DOS shell with substitution of the actual paths for $(ProjectDirectory) and $(OutputDirectory). I even tried making deliberate errors (such as robocapy) to see if I got any error messages (which I did). So I don't think it's a syntax error, and the files are all present. Any ideas?

Re: robocopy in post-build events

Posted: Thu Mar 16, 2017 1:56 pm
by GregStenhouse
Maybe try putting your Robocopy command in an external script and calling that script via the Flare target post-build event - and pass the output directory as a parameter.

Your target's post build event would be something like:

Code: Select all

"$(ProjectDirectory)post_publish_script.cmd" "$(OutputDirectory)"
And post_publish_script.cmd (in the high level project dir):

Code: Select all

Robocopy "legal" "%1" /S /XF "*.docx"
Where %1 is the output directory parameter.

Re: robocopy in post-build events

Posted: Wed Apr 12, 2017 10:51 am
by kgdyall
No, that didn't work either.

Re: robocopy in post-build events

Posted: Mon Oct 04, 2021 3:23 am
by oceanclub
I'm wondering if anyone got Robocopy working successful in a pre- or post-build command yet? Have tried myself with no luck.

P