Grooper Help - Version 25.0
25.0.0017 2,127
  • Overview
  • Help Status

Remove Level

Code Activity Grooper.Activities

Removes one or more folder levels which exist below a Batch Folder or Batch.

Remarks

The Remove Level activity is used to flatten the folder structure within a Batch or Batch Folder by removing one or more child folder levels. When executed, the specified number of folder levels beneath the base folder are deleted, and their children are promoted up to the base folder. This is useful for eliminating unnecessary hierarchy, such as after importing or unzipping files, or when restructuring batches for downstream processing.

How It Works

  • The 'Level Count' property determines how many levels below the base folder will be removed.
  • Optionally, you can restrict the operation to folders with a specific file extension using the 'File Extension' property.
  • The 'Require Children' property can be used to ensure only folders containing children are considered for removal.
  • The 'Filter Pattern' property allows you to specify a regular expression to control which descendant items are moved to the root.
  • All children of the deleted folders that match the filter (or all, if no filter is set) are moved to the base folder.
  • After the operation, the batch structure is updated and changes are saved.

Configuration Guidance

  • Use this activity to simplify batch hierarchies, especially after import or extraction steps that create extra folder levels.
  • Adjust the 'Level Count' to control how deep the removal should go.
  • Use 'File Extension' to target only certain types of folders (e.g., ZIP files).
  • Use 'Filter Pattern' to precisely control which items are promoted, using regular expressions that match relative paths.
  • Be cautious when removing levels, as this operation cannot be undone and may affect downstream processing.

Example

The following example demonstrates how Remove Level flattens a batch structure by removing one folder level. In this example, Remove Level is running on each item at folder level 1 and is configured to remove 1 level. Therefore, the subfolders beneath "Folder A" and "Folder B" will be removed.

Before Remove Level:

 Batch
  ├─📁 Folder A
  │ ├─📁 Subfolder 1
  │ │ ├─📄 Page 1
  │ │ └─📄 Page 2
  │ └─📁 Subfolder 2
  │   └─📄 Page 3
  ├─📁 Folder B
  │ ├─📁 Subfolder 1
  │ │ ├─📄 Page 4
  │ │ └─📄 Page 5
  │ └─📁 Subfolder 2
  │   └─📄 Page 6
 

After Remove Level:

 Batch
  ├─📁 Folder A
  │ ├─📄 Page 1
  │ ├─📄 Page 2
  │ └─📄 Page 3
  ├─📁 Folder B
  │ ├─📄 Page 4
  │ ├─📄 Page 5
  │ └─📄 Page 6
 

In this example, all pages from the subfolders are promoted up one level, and the subfolders are removed.

For more information, see the documentation for Batch, Batch Folder, and Code Activity.

Properties

NameTypeDescription
General
Processing Options

Used By

Notification