Rename File
Renames a file.
See also
Options
- Source file is the path of the file to rename. See Creating file paths.
- New name is a text expression that specifies the new name of the file.
Compatibility
Product | Supported |
FileMaker Pro | Yes |
FileMaker Go | Yes |
FileMaker WebDirect | No |
FileMaker Server | Yes |
FileMaker Cloud | Yes |
FileMaker Data API | No |
Custom Web Publishing | Yes |
Originated in version
18.0
Example 1
Renames the change.log file to change1.log.
Copy
Rename File [ Source file: "change.log" ; New name: "change1.log" ]
Example 2
Adds the current date to the end of the file named change.log if the file exists.
Copy
Set Variable [ $file ; Value: "change.log" ]
Get File Exists [ "$file" ; Target: $fileExists ]
If [ $fileExists ]
Rename File [ Source file: "$file" ; New name:
Let ( [
filename = Left ( $file ; Length ( $file ) - 4 ) ;
extension = Right ( $file ; 3 ) ;
date = Get ( CurrentDate ) ;
year = Year ( date ) ;
month = Month ( date ) ;
day = Day ( date )
];
filename & "-" & year & "-" & month & "-" & day & "." & extension
) ]
End If