Infinitive form in reported commands
I know that "I tried not to do that" and "I tried to not do that" are both valid sentences grammatically speaking. But can the second construction be applied to reported commands? Is it correct to say, for example:
He told me to not do that.
This sentence sounds ungrammatical to my ears. But so did the sentence "I tried to not do that" until a while ago. I used to hear this construct by non-native English speakers whose native language interfered with their command of English. Now I know that this hasn't been the case. What about reported commands?
Let’s take another example. ‘I command you not to attack before dawn,’ the general ordered his troops would be reported as The general ordered his troops not to attack before dawn. However, what if the original was ‘I command you to not attack before dawn,’ the general ordered his troops? To be faithful to the general’s words, wouldn't that have to be reported as The general ordered his troops to not attack before dawn?
I'm not saying your second example is incorrect, but it doesn't sound very natural to me, either in direct or indirect speech. This from Michael Swan in Practical English Usage - 'Negative forms (of infinitives) are normally made by putting not before the infinitive', and he gives as an example - Try not to be late, rather than Try to not be late
Usage in books overwhelmingly suggests the same, according to ngrams: