This notebook allows you to rename a set of files. You can define
- the prefix file name from scratch or used part of the old name
- the starting index
- the index number of digits
The main use of this notebook
In this notebook, we will correctly format the file name index of the file selected. This allows the sorting of the file name to work all the time. For example, there are many cases where the images are saved using the following convention.
Wrong filename index
Using this convention, any sorting algorithm will sort them as followed
So this notebook will fix this issue by renaming the files
correct filename index
Select your IPTS
Need help using the IPTS selector?
Select images to rename
Using the folder selection tool, select the folder for which you want to rename the files.
Only the most dominant file type (ex: tiff, fits) from the folder will be renamed
Define new naming schema
Current schema name
This is where you define the way the current file name is defined. You need to specify what string separates the first part of the file name from the index. If you decide to not fully rename the images, the string before this separator will be kept in the new file name.
The Random input dropdown list displays a random selection of the input files, to help you in defining the separator string. Play with it to make sure you correctly defined the current file name (what is the prefix, what is a separator). Use the slider to the right of the file name prefix to define the prefix part of the name (as shown in the following animation).
New naming schema
Here, you define if you want to keep the old prefix or not, the new prefix file name, index separator, number of digits, and offset of this index.
- old file name: experiment_0845454_10.tiff
- separator: _
- new file name prefix: my_image
- number of digits: 4
- offset: 15
- new file name will be: my_image_0025.tiff
Checking new names
Running this cell will display the old file names and the new file names.
You simply need to select where the newly renamed file will be created. Then the program will copy the selected files and rename them in the folder you selected.