---
title: "Drive.File.Operation"
slug: "drivefileoperation"
updated: 2026-06-29T12:51:44Z
published: 2026-06-29T12:51:44Z
canonical: "support.lusid.com/drivefileoperation"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.lusid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Drive.File.Operation

| Type | Read/write | Author | Availability |
| --- | --- | --- | --- |
| [Data provider](/v1/docs/what-are-a-data-provider-and-a-direct-provider#data-provider) | Write | FINBOURNE | Provided with LUSID |

The `Drive.File.Operation` provider enables you to write a [Luminesce query](/v1/docs/understanding-the-luminesce-sql-query-syntax) that performs the following operations upon files in [Drive](/v1/docs/drive):

- `Delete`
- `MoveRename`
- `MoveRenameMayOverwrite`
- `Copy`
- `CopyMayOverwrite`

Note the similar [Sftp.File.Operation](/v1/docs/readwrite-sftp-server-files-sftp) provider adds the following operations to copy files between an SFTP server and Drive in a single query:

- `CopyFromDrive`
- `CopyFromDriveMayOverwrite`
- `CopyToDrive`
- `CopyToDriveMayOverwrite`

**See also:** [Drive.File](/v1/docs/drivefile), [Drive.SaveAs](/v1/docs/drivesaveas)

## Basic usage

```sql
@data = select <file-paths-and-operation>;
select * from Drive.File.Operation
  where and UpdatesToPerform = @data;
```

## Query parameters

`Drive.File.Operation` has a single mandatory `UpdatesToPerform` parameter that encapsulates the files and operation to perform.

## Basic usage

By default, `Drive.File.Operation` returns a table of data populated with particular fields (columns). You can return just a subset of these fields if you wish.

To list fields available to return, their data types, whether fields are considered 'main', and an explanation for each, run the following query using a [suitable tool](/v1/docs/what-tools-are-available-to-write-luminesce-queries):

```sql
select FieldName, DataType, IsMain, IsPrimaryKey, SampleValues, Description from Sys.Field where TableName = 'Drive.File.Operation' and FieldType = 'Column';
```

## Examples

> **Note**: For more examples, try the [Luminesce Github repo](https://github.com/finbourne/luminesce-examples/tree/master/examples/drive).

### Example 1: Move a file into a new folder

Any folders specified in `NewFullPath` are created if they do not already exist.

If you do not want existing files to be overwritten, specify `'MoveRename' as Operation` instead.

```sql
@data = select 
  '/luminesce/testing/myfile.csv' as FullPath,
  '/luminesce/my-new-folder/myfile.csv' as NewFullPath,
  'MoveRenameMayOverwrite' as Operation;

select * from Drive.File.Operation
  where UpdatesToPerform = @data;
```

### Example 2: Rename a file

Note the filename and path are case-sensitive.

```sql
@data = select 
  '/myfile.csv' as FullPath,
  '/myrenamedfile.csv' as NewFullPath,
  'MoveRenameMayOverwrite' as Operation;

select * from Drive.File.Operation
  where UpdatesToPerform = @data;
```

### Example 3: Rename multiple files

You can specify one or more rows in `UpdatesToPerform` to move, rename or delete multiple files in one call.

```sql
@files_to_rename = values
('/myfile.csv', '/myrenamedfile.csv'),
('/myotherfile.csv', '/myotherrenamedfile.csv');

@table_of_data = select 
  column1 as FullPath, 
  column2 as NewFullPath, 
  'MoveRenameMayOverwrite' as Operation from @files_to_rename;

select * from Drive.File.Operation
  where UpdatesToPerform = @table_of_data;
```

### Example 4: Delete a file

```sql
@data = select 
  '/myfile.csv' as FullPath,
  'Delete' as Operation;

select * from Drive.File.Operation
  where UpdatesToPerform = @data;
```
