Backup n8n workflows

Describe the problem/error/question

Hi, I am trying to do a simple workflow to save all my workflows on my computer, the workflow is the following (very simple).

It works and saves all the workflows, but it overwrite all the workflows every time it runs. Instead I want it to overwrite only the workflows that are different to the ones saved?

Thanks for any reply

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: community 1.119.2
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: MacOs

It’s overwriting because it’ll have the same workflow name every time. You could add a unique identifier into the filename structure. A date might be good so you can see the versions.

{{$json.name.replace(/\s+/g, ‘-’).toLowerCase() + ‘-’ + $now.format(‘yyyy-MM-dd’) +‘.json’}}