renamefromsource
Description
The renamefromsource command renames files listed in a CSV source. The CSV file provides the information needed to map file IDs to their new names and folder IDs. This command supports alias evaluation for dynamic renaming.
Syntax
renamefromsource -filePath -evaluatealias -csv
Parameters
filePath: (Required) The source file path. This must be a CSV file with three columns:
- File ID: The ID of the file to be renamed.
- New File Name: The new file name, including the extension.
- Folder ID: The ID of the folder containing the file.
evaluatealias: Toggle. This allows placeholders to be used in the new file name.csv: Specifies the path to an additional CSV file for batch renaming.
Examples
Rename files using a source CSV file:
renamefromsource -filePath "C:\data\rename.csv" -evaluatealias
# renamefromsource
CSV Format
The source CSV file must have the following structure:
| File ID | New File Name | Folder ID |
|---|---|---|
| 123 | newfile1.txt | 456 |
| 124 | anotherfile.docx | 457 |
| 125 | examplefile_backup.pdf | 458 |
- File ID: The ID of the file to be renamed.
- New File Name: The desired new name for the file, including the extension.
- Folder ID: The ID of the folder containing the file.
Remarks
- The
filePathparameter is mandatory and must point to a valid CSV file. - The
evaluatealiasparameter supports placeholders for renaming, such as $name, $revision, $yyyy, etc. Ensure the CSV file is properly formatted with three columns: File -ID, New File Name, and Folder ID. - The
csvparameter is optional and can be used to provide additional renaming data.
For more information about alias evaluation, refer to the Placeholders in PDMShell.
Tutorial
Availability
Available since PDMShell 2.0.2.