Rename - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


FileTools

  

Rename

  

rename a file

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

Rename(old, new, opts)

Parameters

old

-

string; source filename

new

-

string; destination filename

opts

-

(optional) options as described below

Options

• 

force=one of true or false

  

The optional argument force controls Rename's behavior when a file named new already exists.  If force=false then an error is raised and the renaming does not occur.  This is the default behavior. If force=true then the file is replaced by the renaming.

Description

• 

The Rename(old, new) command moves the file old to the new location new.

• 

The Rename function does not return anything.

• 

If either new or old refers to an open file, it is automatically closed before the move.

• 

The optional argument force controls the behavior when the file new exists.

• 

If the user does not have permission to perform the operation, an exception is raised.

Examples

FileToolsTextWriteLinetestfile,this is a test

15

(1)

FileToolsTextClosetestfile

FileToolsRenametestfile,testfile2

The file "testfile" cannot be read because it has been renamed.

FileToolsTextReadLinetestfile

Error, (in fopen) file or directory does not exist

FileToolsTextReadLinetestfile2

this is a test

(2)

FileToolsRemovetestfile2

See Also

file_types

FileTools

FileTools[Binary][Close]

FileTools[Binary][Open]

FileTools[Remove]

FileTools[Text][Close]

FileTools[Text][Open]

FileTools[Text][ReadLine]

FileTools[Text][WriteLine]

IO_errors