Reference > Script steps reference > Files script steps > Rename File
 

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 Advanced 

Yes 

FileMaker Go 

Yes 

FileMaker WebDirect 

No 

FileMaker Server 

Yes 

FileMaker Cloud products 

Yes 

FileMaker Data API 

No 

Custom Web Publishing 

Yes 

Runtime solution 

No 

Originated in 

FileMaker Pro 18.0 Advanced

Example 1 

Renames the change.log file to change1.log.

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.

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

Related topics 

Create Data File script step

Delete File script step

Script steps reference (alphabetical list)

Script steps reference (category list)