Keep your Google Drive tidy by finding and handling duplicate files in a chosen folder. You can keep the first or last copy and either send the extras to trash or mark them with a clear DUPLICATE prefix. Ideal for teams that share upload folders and need clean storage without manual checks.
The flow starts with a Google Drive trigger that checks the selected folder every 15 minutes for new uploads. A folder scan gathers files at depth level one and removes Google Docs types, since those are links and cannot be compared like real files. A setting decides whether to keep the earliest or latest file, and a code step sorts by created time to tag duplicates. A filter passes only items marked as duplicates. Another setting chooses the action path to either delete the extras or rename them. A safety check skips files already marked so nothing gets renamed twice. Owner and folder values come from the trigger to avoid acting on files you do not own. An Edit Fields step keeps the flags consistent, and a NoOp step cleanly ends already flagged items.
Connect a Google Drive account in n8n Cloud, set your poll time and folder, and confirm the owner matches the files. Start with the flag option so you can review the output before turning on trash. Remember that Google Drive keeps trashed files for 30 days, so recovery is possible. Expect faster reviews, fewer mistakes, and less wasted space in busy shared folders.