Problem with deleting files from uploads on Dropbox / OneDrive

I’m a new Local user. As the folder for storing site files, I set a OneDrive folder because I need to have access to the project’s files on 3 different computers. Everything was working perfectly until, while adding files in the wp-admin panel, I noticed that when I delete a file and then re-upload it in WP, the file name gets an extra number appended to it as if it were a duplicate — even though I had deleted the previous file and uploaded a new one with the same name. That’s when I saw that the files physically remain in wp-content/uploads.

I tried with a clean WP install, and at first it worked. Then I started looking into whether it might be a configuration or plugin issue on my site.

A test text file uploaded into wp-content/uploads and deleted via PHP works fine — it is removed.

After some time, though, deletion stopped working even on the clean WP. I tried turning sync on and off — no effect.

What’s more interesting, I tried moving the project to a Dropbox folder, and the same thing happened.

When I set any other directory on my disk for site files (other than a Dropbox/OneDrive folder), everything works.

Has anyone encountered this problem? Windows 11.

Welcome to the Local community and thanks for your question, @siepaw.

Cloud drives can leave behind placeholder files when deleted because they don’t always delete a file immediately; they hide it and mark it deleted to allow sync or restore later. WordPress appends the -1 or -2 etc. because the original file is still there awaiting sync or cleanup.

If this is an issue for you, you could keep your Local sites outside of cloud folders, then sync between machines using one or more of:

  • Git for themes/plugins.
  • Local’s export/import option.
  • Media offload plugins for images/media.
  • Backup and recreation using Local’s Cloud Backups add-on.
  • WP Migrate or similar for database import/export.

Thank you very much for your answer.