Google Drive Duplicate File Upload

Google Drive Duplicate file check.

I am trying to check if the file I pulled from slack has already been uploaded by comparing the names in an If statement. I first searched Google Drive for the file name using the search function and then looped through each file pulled to see if they both had the same name. If they do I don’t want to upload them. If they don’t, then I want to upload the new file. The issue is that it keeps uploading each video file regardless of if its already in the folder.

Example Google Drive Folder with duplicates

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: Online verision
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: MAC

It will probably help some to get rid of the “Loop over Items” I don’t think you need it. You can just let the whole list of items flow through each step and n8n will do the looping for you.

I think also that the “If” node checks whether $json.name differs from the name of the current loop item, If the names are different (indicating that the file does not exist in Drive), the workflow follows the top path to upload the file!

Yes this is how it should work but its still uploading files that match a searched files name.

See if this linear flow would do what you want. (You can add your slack stuff back in once you verify the upload / duplicate rejection thing.)

Failed and uploaded the same file 3 times.

Sorry about that… Copy it again (corrected the If expression… too late I guess).

Should be {{ $input.first().json['name'] === undefined }} instead of {{ $input.first()['name'] === undefined }}

1 Like

Still failed :confused:

Could you post a screenshot of the If node details on the execution where it uploaded a duplicate.

Also, did you fix the parent folder in both of the Google Drive nodes?

That fixed it thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.