Is there an API to disable OneDrive for a folder?

See title.
When customers have turned OneDrive on, iterating through a folder of files is incredibly slow, compared to a non-synched folder.
Is there a way to disable it for one folder in code
(I know it can be done manually)