WRITEFILE        Write string to specified text file

Top  Previous  Next

Syntax:

WRITEFILE

[ file name ] [ string_out ] [ /options ]

Arguments:

[ file name ]

A variable or string to specify the file name to write to; if no path is defined Robo-FTPs working folder is used; if the file does not exist, it is created.

 

[ string_out ]

A variable or string to be written to the file.

Options:

/append

Append the string to the existing file.

 

/hex

Interpret the output string as a hexadecimal value rather than as standard ASCII characters.  Use this option if you need to write binary data.

 

 

This script command writes characters to the specified text file. This command is oriented toward writing a complete record of printable characters, terminated by a carriage-return/ line-feed, to a file. The scope of this command (and the READFILE command) is not to provide full function file I/O to your script files, but rather to provide temporary storage for small amounts of information for use by a script file or an external program.

 

By default WRITEFILE either creates a new file or over-writes an existing file with what is written. You may use the /append option to add records to an existing file.

 

Consider the following example.

 

;; write a string supplied by an operator to a file

PROMPT user_id "Enter your Used ID"

WRITEFILE "user_info.txt" user_id /append

 

Note: The %crlf internal variable is available for adding additional line breaks to your output string.

 

 

Related Command(s): READFILE, WORKINGDIR,MAKEFILENAME, MAKEDIR, COPY, RENAME, DELETE, APPEND

See also: %crlf