Delete empty case folders

Note: Some of the recipes listed below now exist as knowledge base articles on the Relativity Community. When you click those links, you must enter valid Community credentials to access those articles. The remaining recipes will soon be integrated into their corresponding feature documentation so that they'll show up either as new topics or new headings within existing topics. Once this relocation is complete, we will be deprecating this home page, and all of the content below will be accessible via search on our sites.

You must have valid Relativity Community credentials in order to download any Community file linked to the documentation site. You'll need to enter those credentials on the Community login screen if you're not already logged in. If you're already logged in to the Community at the time you click a link, the file is automatically downloaded in the bottom left corner of your screen. If you get an error message stating "URL No Longer Exists" after clicking a Community link, it may be due to a single sign-on error related to the SAML Assertion Validator, and you should contact your IT department.

The Delete Empty Case Folders solution identifies and deletes empty folders from a workspace. To download the solution files, visit the Relativity Community.

This page contains the following sections:

Before you begin

The Delete Empty Case Folders solution identifies and deletes one or more folders from a workspace if the folder doesn't contain any documents or any subfolders that contain documents.

Supported versions

This solution is supported in Relativity 8.0 – Server 2021.

Solution version Supported Relativity version
3.1 8.2 - Server 2021


This solution consists of a Relativity script that runs at the workspace level.


  • This script should only be run by a system admin. If you are not a system admin, we recommend you do not run this script.
  • This solution doesn't create an audit record when it deletes a folder from a workspace.
  • The results of running this solution are permanent and cannot be undone.
  • This solution doesn't support the client domains (multi-tenancy) and Data Grid features of Relativity.

Deploying and configuring the solution

Note: This solution is now available as an application. If you are upgrading from a script version of the solution to an application version of the solution, you must delete the original script before adding the new application to your environment and installing it to a workspace.

To deploy the solution, you first add it to the Application Library as a Relativity application. You can then install it from the Application Library to one or more workspaces.

Note: This script runs from the Admin level, you must install this application into a workspace for it to appear in the Script Library (at the instance level).

To add the solution to the Application Library:

  1. Log in to Relativity.
  2. Click the user drop-down menu in the upper-right corner of Relativity, and then click Home.
  3. Click the Applications & Scripts tab, and then click the Application Library tab.
  4. Click Upload Application.
  5. Click Choose file to select an application file.
  6. Navigate to and select the application file included in the solution, and then click Open.
  7. Click Save to upload the file to the Application Library.

To add the solution to a workspace:

  1. Click Install in the Workspaces Installed section to install the application on workspaces.
  2. Click in the Workspaces field to display the Select Workspaces dialog.
  3. Select the workspace(s) where you want to install the application, and then click Ok.
  4. (Optional) Click Clear to remove a workspace from the list.
  5. Click Save to install the application to the selected workspaces. These workspaces now contain the application. Relativity lists the workspaces in the Workspaces Installed section on the detail view of the application.

Running the solution

To run the solution, you run the Delete Empty Case Folders script from the workspace where you installed the solution. To run the script:

  1. In the workspace, navigate to the Scripts tab.
  2. Click the name of the Delete Empty Case Folders script.
  3. In the console, click Run Script.
  4. Click Run.

The results appear on the script page.

Viewing the results

After you run the Delete Empty Case Folders script, the results appear as a report on the script page. If the script ran successfully and there were no empty folders to delete or the script deleted one or more empty folders successfully, the report displays a message indicating that empty folders were deleted and no errors occurred.

The Delete Empty Case Folders script report indicating that all empty folders were deleted successfully.

If the script identified but didn't delete one or more empty folders due to dependencies, the report provides detailed information about each of those folders and the error that occurred.

The Delete Empty Case Folders script report indicating that an error occurred for a folder and what the error was.

The following table lists and describes the columns in the report.

Column Description
Folder Artifact ID The Artifact ID of the folder.
Folder Name The name of the folder.
Full Folder Path The full path to the folder.
Error Message The error that occurred and prevented the script from deleting the folder.