{"id":"Kg8UgSiA0utYWQ0J","meta":{"instanceId":"8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177","templateCredsSetupCompleted":true},"name":"Auto move files","tags":[],"nodes":[{"id":"ebf3a973-602f-4a01-8a74-6df55ad6d113","name":"If Image","type":"n8n-nodes-base.if","notes":"🖼️ IMAGE FILE DETECTION\n\nChecks if the uploaded file is an image:\n\n• Examines the file's MIME type\n• Looks for 'image/' in the MIME type\n• Supports: JPG, PNG, GIF, WebP, SVG, etc.\n• TRUE path: Routes to 'Move to Images'\n• FALSE path: File continues to next filter\n\nExample MIME types: image/jpeg, image/png","position":[400,976],"parameters":{"options":{"ignoreCase":true,"looseTypeValidation":false},"conditions":{"options":{"version":1,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"3e4622cc-91f0-4cbd-bd55-e3ad4e28f32b","operator":{"type":"string","operation":"equals"},"leftValue":"={{$binary.data.mimeType}}","rightValue":"image/jpeg"}]}},"typeVersion":2,"alwaysOutputData":true},{"id":"13e7f0a2-8dde-4e42-a94f-1f81353c95e9","name":"If PDF","type":"n8n-nodes-base.if","notes":"📄 PDF FILE DETECTION\n\nChecks if the uploaded file is a PDF document:\n\n• Looks for exact MIME type 'application/pdf'\n• Only matches PDF files\n• TRUE path: Routes to 'Move to PDFs'\n• FALSE path: File continues to next filter\n\nThis ensures only genuine PDF files are moved to the PDF folder.","position":[256,576],"parameters":{"options":{},"conditions":{"options":{"version":1,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"18052dba-fa6b-4fd4-ac5f-f6abb10575b9","operator":{"type":"string","operation":"equals"},"leftValue":"={{$binary.data.mimeType}}","rightValue":"application/pdf"}]}},"typeVersion":2},{"id":"e5331e89-34c7-4e63-b542-0d44b7e1aa42","name":"Move to Images","type":"n8n-nodes-base.googleDrive","notes":"📁 MOVE IMAGE FILES\n\nMoves detected image files to the Images folder:\n\n• Uses the file ID from the trigger\n• Moves file to designated Images folder\n• Maintains file properties and permissions\n• Removes file from upload folder\n\nReplace 'YOUR_FOLDER_ID_IMAGES' with your actual Images folder ID.","position":[672,1328],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json['id'] }}"},"driveId":{"__rl":true,"mode":"list","value":"My Drive"},"folderId":{"__rl":true,"mode":"list","value":"1_ecL9heszdG2vACtpfHsVEe4OAs89DzM","cachedResultUrl":"https://drive.google.com/drive/folders/1_ecL9heszdG2vACtpfHsVEe4OAs89DzM","cachedResultName":"images_check"},"operation":"move"},"credentials":{"googleDriveOAuth2Api":{"id":"gQtjXVGUgZru29qC","name":"Google Drive account"}},"typeVersion":3},{"id":"d456c42b-604e-4a1d-ac7b-cea42c35a004","name":"Move to PDFs","type":"n8n-nodes-base.googleDrive","notes":"📄 MOVE PDF FILES\n\nMoves detected PDF files to the PDFs folder:\n\n• Uses the file ID from the trigger\n• Moves file to designated PDFs folder\n• Maintains file properties and permissions\n• Removes file from upload folder\n\nReplace 'YOUR_FOLDER_ID_PDFS' with your actual PDFs folder ID.","position":[608,752],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json['id'] }}"},"driveId":{"__rl":true,"mode":"list","value":"My Drive","cachedResultUrl":"https://drive.google.com/drive/my-drive","cachedResultName":"My Drive"},"folderId":{"__rl":true,"mode":"list","value":"1dHG2GI5WF3bg-Bw9ydD5fC_P5GqvdBFG","cachedResultUrl":"https://drive.google.com/drive/folders/1dHG2GI5WF3bg-Bw9ydD5fC_P5GqvdBFG","cachedResultName":"pdf_check"},"operation":"move"},"credentials":{"googleDriveOAuth2Api":{"id":"gQtjXVGUgZru29qC","name":"Google Drive account"}},"typeVersion":3},{"id":"49fdce70-3f51-4edd-81fd-7c6f655b6c62","name":"If Document","type":"n8n-nodes-base.if","notes":"📋 DOCUMENT FILE DETECTION\n\nChecks if the uploaded file is a document:\n\n• Looks for 'application/' OR 'text/' MIME types\n• Catches: Word docs, Excel, PowerPoint, text files\n• Excludes PDFs (handled separately)\n• TRUE path: Routes to 'Move to Documents'\n• FALSE path: File stays in upload folder\n\nExamples: .docx, .xlsx, .pptx, .txt, .rtf","position":[-48,304],"parameters":{"options":{},"conditions":{"options":{"version":1,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"5ed7c752-f41d-496d-a003-56c95572b629","operator":{"type":"string","operation":"equals"},"leftValue":"={{$binary.data.mimeType}}","rightValue":"application/json"}]}},"typeVersion":2},{"id":"6b1feaf3-4e3b-427c-9e82-7e5df72f284c","name":"Move to Documents","type":"n8n-nodes-base.googleDrive","notes":"📋 MOVE DOCUMENT FILES\n\nMoves detected document files to the Documents folder:\n\n• Uses the file ID from the trigger\n• Moves file to designated Documents folder\n• Handles Word, Excel, PowerPoint, text files\n• Maintains file properties and permissions\n\nReplace 'YOUR_FOLDER_ID_DOCUMENTS' with your actual Documents folder ID.","position":[528,288],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json['id'] }}"},"driveId":{"__rl":true,"mode":"list","value":"My Drive","cachedResultUrl":"https://drive.google.com/drive/my-drive","cachedResultName":"My Drive"},"folderId":{"__rl":true,"mode":"list","value":"1KUO_jw0WCQR1lDwlkvTk1XP_0PoLb3RR","cachedResultUrl":"https://drive.google.com/drive/folders/1KUO_jw0WCQR1lDwlkvTk1XP_0PoLb3RR","cachedResultName":"json_check"},"operation":"move"},"credentials":{"googleDriveOAuth2Api":{"id":"gQtjXVGUgZru29qC","name":"Google Drive account"}},"typeVersion":3},{"id":"35df71bd-e674-4dc6-bbac-4ca6ae319d04","name":"Download file","type":"n8n-nodes-base.googleDrive","position":[-512,304],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{$json['id']}}"},"options":{},"operation":"download"},"credentials":{"googleDriveOAuth2Api":{"id":"gQtjXVGUgZru29qC","name":"Google Drive account"}},"typeVersion":3},{"id":"358f6aba-5ac4-48c3-980a-296a75cae6fd","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[-496,912],"parameters":{"options":{}},"typeVersion":3},{"id":"42c75b0e-47eb-442a-a842-e3e2fbe75d71","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-944,912],"parameters":{},"typeVersion":1},{"id":"fb6d583c-79e8-433e-916c-e71da9352e4b","name":"Search files and folders","type":"n8n-nodes-base.googleDrive","position":[-720,912],"parameters":{"filter":{"folderId":{"__rl":true,"mode":"list","value":"1CcHp9tPoC-f7-umMjLdUU-Y7GedKLQkx","cachedResultUrl":"https://drive.google.com/drive/folders/1CcHp9tPoC-f7-umMjLdUU-Y7GedKLQkx","cachedResultName":"Indore"}},"options":{},"resource":"fileFolder","returnAll":true},"credentials":{"googleDriveOAuth2Api":{"id":"gQtjXVGUgZru29qC","name":"Google Drive account"}},"typeVersion":3},{"id":"c7a7346e-0529-4191-a7cb-c56f02781d2a","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-832,672],"parameters":{"height":224,"content":" Search files and folders (Google Drive)\n\nPurpose: Finds all files in a specific Google Drive folder\nFunction: Searches the \"Particular\" folder (ID:) for files to process\n\nOutput: Returns a list of all files found in that folder"},"typeVersion":1},{"id":"ed19e989-a464-48cd-9b27-43d9850df4de","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-496,704],"parameters":{"color":3,"width":272,"height":192,"content":"Loop Over Items (Split in Batches)\n\nPurpose: Processes files one by one\nFunction: Takes the list of files and processes each file individually through the workflow\n\nFlow: Creates a loop that continues until all files are processed"},"typeVersion":1},{"id":"107bb7f1-ff82-4b04-8e4b-9beea97d479a","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-752,48],"parameters":{"color":2,"width":272,"height":224,"content":"Download file (Google Drive)\n\nPurpose: Downloads file metadata and binary data\n\nFunction: Retrieves the file's MIME type and other properties needed for classification\nCritical: This step gets the file information needed for the conditional nodes"},"typeVersion":1},{"id":"57ee82da-1948-4185-abf4-dc8bd251c125","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-144,-16],"parameters":{"color":4,"width":304,"height":288,"content":" If Document (Conditional Node)\n\nPurpose: Detects JSON document files\n\nLogic: Checks if MIME type equals \"application/json\"\nTrue Path: Routes to \"Move to Documents\"\n\nFalse Path: Continues to next filter (PDF check)\n\nNote: Despite the name, this specifically looks for JSON files"},"typeVersion":1},{"id":"775c6f0f-3dbc-4e29-a7a3-97fd13a08afd","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[432,16],"parameters":{"color":6,"height":240,"content":"Move to Documents (Google Drive)\n\nPurpose: Relocates JSON files to Documents folder\nTarget Folder: \"Your folder\" folder (ID:)\n\nAction: Moves file from source location to Documents folder\nAfter Move: Returns to loop for next file"},"typeVersion":1},{"id":"e96270c2-507a-4ac7-aa62-0aaf28ed3c2c","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-32,608],"parameters":{"color":5,"height":304,"content":"If PDF (Conditional Node)\n\nPurpose: Detects PDF files\n\nLogic: Checks if MIME type exactly equals \"application/pdf\"\n\nTrue Path: Routes to \"Move to PDFs\"\n\nFalse Path: Continues to image check\n\nPrecision: Only matches genuine PDF files"},"typeVersion":1},{"id":"f92b7dcb-e767-42da-899d-2bff7130b60e","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[720,512],"parameters":{"color":3,"height":272,"content":"Move to PDFs (Google Drive)\n\nPurpose: Relocates PDF files to PDFs folder\n\nTarget Folder: \"Your folder\" folder (ID:)\n\nAction: Moves file from source location to PDFs folder\n\nAfter Move: Returns to loop for next file"},"typeVersion":1},{"id":"17fd8e38-d636-496f-a1d7-ec413148a2bc","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[240,1120],"parameters":{"color":7,"height":368,"content":"If Image (Conditional Node)\n\nPurpose: Detects image files\n\nLogic: Checks if MIME type equals \"image/jpeg\" (though notes suggest broader image support)\n\nTrue Path: Routes to \"Move to Images\"\n\nFalse Path: File remains unprocessed\n\nCoverage: Handles JPG files (could be expanded for PNG, GIF, etc.)"},"typeVersion":1},{"id":"8c58f9d7-5c77-4d2a-83f9-061c2ac30810","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[832,1312],"parameters":{"color":5,"height":272,"content":"Move to Images (Google Drive)\n\nPurpose: Relocates image files to Images folder\n\nTarget Folder: \"Your folder\" folder (ID:)\n\nAction: Moves file from source location to Images folder\n\nAfter Move: Returns to loop for next file"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"d08c53f6-2f34-4ffb-acb7-02d2fa36e73b","connections":{"If PDF":{"main":[[{"node":"Move to PDFs","type":"main","index":0}],[{"node":"If Image","type":"main","index":0}]]},"If Image":{"main":[[{"node":"Move to Images","type":"main","index":0}],[]]},"If Document":{"main":[[{"node":"Move to Documents","type":"main","index":0}],[{"node":"If PDF","type":"main","index":0}]]},"Move to PDFs":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Download file":{"main":[[{"node":"If Document","type":"main","index":0}]]},"Move to Images":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Download file","type":"main","index":0}]]},"Move to Documents":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Search files and folders":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Search files and folders","type":"main","index":0}]]}}}