Best practices for using PlatformIO with cloud-synced folders (e.g., OneDrive)

Hi everyone,

I store my main PlatformIO project directory inside OneDrive to keep my code backed up and synchronized across multiple computers.

However, I’ve noticed that OneDrive constantly syncs the .pio directory for each project. This folder is large, contains thousands of small files, and is frequently updated during compilation, leading to high network traffic and unnecessary cloud storage usage. Since the .pio folder can be regenerated by PlatformIO at any time, syncing it feels redundant.

What is the recommended workflow for this scenario? I’m looking for a way to keep my source code in a cloud-synced folder without also syncing the temporary build files.

Is there a way to configure PlatformIO to place the build directory (.pio) outside of the project’s source tree? For example, could I set up a global, non-synced build cache somewhere else on my system?

Thank you for any advice or suggestions!

The answer is: don’t do this!
In the past this always lead to issues as PlatfromIO does not support these type of folders.

Git / github is the way to go.
In the .gitignore specify .pio and .vscode folders to exclude them.

It’s also possible to have your project directory synced locally to a directory inside OneDrive using e.g. FreeFileSync. It can exclude .pio directory from syncing. Once in a while you run FreeFileSync to sync these two local directories, then OneDrive will do its thing to upload it to the cloud.