# Moving Bucket Data Between Storage Providers

> In some cases, it might be necessary to transfer storage bucket data from one provider to another.

In some cases, it might be necessary to transfer storage bucket data from one provider to another.

## Migrating Bucket Data From FileSystem to Orchestrator Storage

The following procedure covers scenarios where you currently rely on FileSystem as a storage provider and want to move to Orchestrator, provided that its configured storage type is FileSystem. For convenience, we will refer to FileSystem as **source** and to Orchestrator as **destination**.

1. Pause all processes that use the source bucket.
2. Create a new bucket of type **Orchestrator** in the same folder as the source bucket.
3. Identify the base path for Orchestrator buckets. Open Orchestrator's `UiPath.Orchestrator.dll.config` file and locate the `Storage.Type` and `Storage.Location` keys. If `Storage.Type` is `FileSystem`, then the base path is what follows the `RootPath` prefix.
4. Identify the relative path of the destination bucket by running the following SQL query:
   ```
   declare @tenancyName nvarchar(64) = N'{tenant name}'
   declare @folderFullyQualifiedName nvarchar(1000) = N'{folder full path}'
   declare @destinationBucketName nvarchar(128) = N'{destination bucket name}'
   select '\)\)Orchestrator-' + LOWER(t.[Key]) + '\)\)BlobFilePersistence\)\)' +
       LOWER((select cast(b.[Identifier] as nvarchar(128))
           from dbo.Buckets b
           inner join dbo.OrganizationUnits ou
               on ou.Id = b.OrganizationUnitId
           where ou.TenantId = t.Id and ou.IsDeleted = 0 and ou.[FullyQualifiedName] = @folderFullyQualifiedName
               and b.TenantId = t.Id and b.IsDeleted = 0 and b.[Name] = @destinationBucketName))
   from dbo.Tenants t
   where t.TenancyName = @tenancyName and t.IsDeleted = 0
   ```
5. Copy all files and folders from the source bucket location to the destination bucket location.
   * To copy the files and folders, you need to go to the **Storage Buckets** page, locate the source bucket, select **Edit**, and then click **Files location**.
   * The destination bucket location has the following format: **{base path} + {relative path}** (see **Step 3.** and **Step 4.**, respectively).
     :::note
     If the last segment of the relative path (which should be a folder) does not exist, create it before copying the files. After the copying operation completes, verify that the files are visible in Orchestrator under the new bucket.
     :::
6. Write down the source bucket name and delete the bucket.
7. Rename the destination bucket by running the following SQL query:
   ```
   declare @tenantName nvarchar(64) = N'{tenant name}'
   declare @folderFullyQualifiedName nvarchar(1000) = N'{folder full path}'
   declare @destinationBucketName nvarchar(128) = N'{destination bucket name}'
   declare @originalBucketName nvarchar(128) = N'{source bucket name}'
   update b
   set b.[Name] = @originalBucketName
   from dbo.Buckets b
   inner join dbo.Tenants t
       on b.TenantId = t.Id
   inner join dbo.OrganizationUnits ou
       on b.OrganizationUnitId = ou.Id
   where b.TenantId = t.Id and b.IsDeleted = 0 and b.[Name] = @destinationBucketName
       and ou.TenantId = t.Id and ou.IsDeleted = 0 and ou.FullyQualifiedName = @folderFullyQualifiedName
   ```
8. Resume the processes paused at **Step 1**.
   :::note
   FileSystem allows you to have two buckets using the same root path. This is not possible if Orchestrator is your storage provider. In this scenario, you need to recompile your workflows to use a single bucket or multiple folder paths in their activities.
   :::
