While individual assets can be renamed by using the “Rename” button in the Asset Inspector, DF Studio also provides a number of features for modifying the names of multiple assets in a bulk operation.
Name changes in DF Studio affect the name of the original uploaded file.
To open the Rename Images overlay, select two or more images and click the “Rename” button in the Asset Inspector.
It is possible to modify the names of all images in the current view, or only a selection of images. DF Studio will assign new numbers to all of the specified images, starting with number 1 for the first image when sorted by the existing name. By default, the new names will take the format: image001, with the correct number of zeroes to ensure that the resulting names will sort in the proper order. The filename text (e.g., “image”), starting number, and number of zeroes can all be customized.
Before committing any bulk renaming operation, click the “Preview New Names” button to confirm the expected result.
Clicking “Rename Images” will commit the operation. This cannot be undone.
Find and Replace Portions of Names
In some cases, it is necessary to apply a custom modification to the asset names to achieve the desired result. For example, the following images are sorted by name but that order does not reflect the correct image sequence:
In the list shown above, the “Rename and Renumber All Images” option would rename image1 to image001 and image10 to image002 based on their position when sorted by the current name. In order to sort properly, some of these names will need one zero added before the image number, while others will need two zeroes. DF Studio's Rename Images tool provides the option to use regular expressions to find and replace portions of a name using a pattern. The following example workflow will create the desired result.
1. Open the Rename Images overlay by selecting images and clicking the “Rename” button, as described above.
2. Select “Find and Replace Portions of Names” and check the box for “Use Regular Expression”.
3. Rename all assets with names that include single-digit numbers:
This will rename image1 to image001 and image2 to image002.
4. Click the “Preview New Names” button to verify the expected outcome, then click the “Rename Images” button to commit the changes.
5. Rename the assets that include two-digit numbers in their filenames by repeating the process with the find and replace patterns below, and clicking “Rename Images” again.
That will rename image10, image11, image12 to image010, image011, image012, resulting in the following list:
See below for a brief explanation of the regular expressions from the example workflow. For further information about regular expressions, see Regular Expression Pattern Matching.
In step 3 of the example, the find pattern image(\d)$ asks the system to find filenames that start with the text “image” followed by a single digit. The \d represents a numeric character, and the parentheses surrounding it tell the system to “capture” the enclosed information for use in the replacement step. The $ stands for “end of line” or the end of the filename. In the replace pattern image00$1 the filename is replaced with the text “image00” as specified, followed by the part captured by the find pattern. In the replacement pattern, $1 represents the first captured item from the find step. Multiple items can be captured and used in the replacement step ($1, $2, $3, etc.).
In step 5, the find pattern searches for “image” followed by (\d\d), which represents two numeric characters. The replace pattern uses the text “image0” since only one zero needs to be added to these filenames, then $1 to specify the 2-digit number from the find pattern.