rfobasic

FTP Client

Ftp.open <url_sexp>, <port_nexp>, <user_sexp>, <pw_sexp>

For example: ftp.open "ftp.laughton.com", 21, "basic", "basic"

Ftp.close

Disconnects from the FTP server.

Ftp.put <source_sexp>, <destination_sexp>

Uploads specified source file to the specified destination file on connected ftp server.

The source file is relative to the directory, "/rfo-basic/data/" If you want to upload a BASIC! source file, the file name string would be: "../source/xxxx.bas".

The destination file is relative to the current working directory on the server.

Ftp.get <source_sexp>, <destination_sexp>

The source file on the connected ftp server is downloaded to the specified destination file on the Android device.

Ftp.dir <list_nvar> {,<dirmark_sexp>}

A directory is identified by a marker appended to its name. The default marker is the string "(d)". You can change the marker with the optional directory mark parameter . If you do not want directories to be marked, set to an empty string, "".

The following code can be used to print the file names in that list:

ftp.dir file_list
list.size file_list,size
for i = 1 to size
 list.get file_list,i,name$
 print name$
next i

-

Ftp.cd <new_directory_sexp>

Changes the current working directory to the specified new directory.

Ftp.rename <old_filename_sexp>, <new_filename_sexp>

Renames the specified old filename to the specified new file name. Ftp.delete

Deletes the specified file.

Ftp.rmdir <directory_sexp>

Removes (deletes) the specified directory if and only if that directory is empty.

Ftp.mkdir <directory_sexp>

Creates a new directory of the specified name.

File Commands

File.delete <lvar>, <path_sexp>

The file or directory at will be deleted, if it exists. If the file or directory did not exist before the Delete, the will contain zero. If the file or directory did exist and was deleted, the will be returned as not zero.

The default path is "/rfo-basic/data/". File.dir , Array$[] {,}

Returns the names of the files and directories in the path specified by . The path is relative to "/rfo-basic/data/".

The names are placed into Array$[]. The array is sorted alphabetically with the directories at the top of the list. If the array exists, it is overwritten, otherwise a new array is created. The result is always a one-dimensional array

A directory is identified by a marker appended to its name. The default marker is the string "(d)". You can change the marker with the optional directory mark parameter . If you do not want directories to be marked, set to an empty string, "".

Dir is a valid alias for this command. File.exists ,

Reports if the directory or file exists. If the directory or file does not exist, the will contain zero. If the file or directory does exist, the will be returned as not zero.

The default path is "/rfo-basic/data/". File.mkdir

Before you can use a directory, the directory must exist. Use this command to create a directory named by the path string .

The new directory is created relative to the default directory "/rfo-basic/data/". For example:

To create a new directory, "homes", in "<pref base drive>/rfo_basic/data/", use the path "homes/", or simply "homes". 

To create a new directory, "icons", in the root directory of the SD card, use "../../icons". 

Mkdir is a valid alias for this command. File.rename ,

The file or directory at old_path is renamed to new_path. If there is already a file present named , it is silently replaced.

The default path is "/rfo-basic/data/".

The rename operation can not only change the name of a file or a directory, it can also move the file or directory to another directory.

For example:

Rename "../../testfile.txt", "testfile1.txt"

removes the file, testfile.txt, from "/", places it into "sdcard/rfo-basic/data/" and also renames it to testfile1.txt.

Rename is a valid alias for this command. File.root

Returns the canonical path from the file system root to "/rfo-basic/data", the default data directory, in . The is expanded to the full absolute path from the file system root, "/". File.size ,

The size, in bytes, of the file at is returned in . If there is no file at , this command generates a run-time error.

The is appended to the default path, "/rfo-basic/data/". File.type ,

Returns a one-character type indicator in for the file at . The is appended to the default data path, "/rfo-basic/data/". The type indicator values are:

Indicator:

Meaning:

"d"

"directory" – path names a directory

"f"

"file" – path names a regular file

"o"

"other" – path names a special file

"x"

file does not exist