Skip to main content

Move File/Folder

Moves a file or folder in Google Drive from one parent folder to another.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Drive Id - The identifier for the connected Google Drive service obtained from the Connect node.
  • File Id - The unique identifier of the file or folder to be moved.
  • From Parent Id - The ID of the current parent folder. Can be empty to add to a new parent without removing from current parents.
  • To Parent Id - The ID of the destination parent folder. Can be empty to remove from the current parent without adding to a new parent.

How It Works

The Move File/Folder node changes the parent folder of a file or folder in Google Drive. When executed, the node:

  1. Validates the required inputs (Drive Id and File Id)
  2. Ensures that at least one of From Parent Id or To Parent Id is provided
  3. Retrieves the Google Drive service client using the provided Drive Id
  4. Depending on the provided parent IDs:
    • If both From and To Parent Ids are provided, removes the file from the From parent and adds it to the To parent
    • If only To Parent Id is provided, adds the file to the new parent (without removing from current parents)
    • If only From Parent Id is provided, removes the file from the specified parent (without adding to a new parent)
  5. Uses the Google Drive API to update the file's parent relationships with the Files.Update method

Requirements

  • A valid Google Drive connection established using the Connect node
  • The File Id of an existing file or folder in Google Drive
  • Appropriate permissions to modify the file or folder
  • Valid parent folder IDs for the move operation

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Drive Id
  • Empty or invalid File Id
  • Both From and To Parent Ids are empty
  • Google Drive API errors during the move operation
  • Insufficient permissions to modify the file or folder
  • Invalid parent folder IDs
  • Attempting to move a file or folder that doesn't exist

Usage Notes

  • This operation modifies the parent relationships of the file or folder
  • A file or folder can have multiple parent folders in Google Drive
  • When both From and To Parent Ids are provided, the file is moved from one folder to another
  • When only To Parent Id is provided, the file is added to a new parent folder while maintaining existing parent relationships
  • When only From Parent Id is provided, the file is removed from the specified parent folder but retains other parent relationships
  • Moving a folder also moves all of its contents
  • The node does not return any output as it only modifies the file's location