Returns information
about a file. When uFileInfo is set to EXISTS
the
function returns the whole path to the file if it exists or an empty
string if it does not exist. uFileInfo is set
to SIZE
the size of the
file is returned or an empty string if the file does not exist.
Be aware that you have to double the backslashes in JavaScript environments because the backslash is used as escape sequence.
string uFileInfo (file [, infotype])
The file to investigate.
The type of information to retrieve. The default
is EXISTS
.
To retrieve file information in JavaScript Calculator:
uFileRead("C:\\windows\\notepad.exe") // returns C:\windows\notepad.exe.
uFileRead("C:\\win\\notepad.exe") // returns C:\windows\notepad.exe.
uFileRead("C:\\windows\\notepad.exe", “SIZE”) // returns 68608.
Returns the content of a file.
string uFileRead(URL [, bytes] [, offset] [, encoding])
The URL specifying the source to read
The number of bytes to read. The default is 0, which means the whole file.
The number of bytes to skip from the beginning of the file. The default is 0.
To access local files:
uFileRead("c:\myFile.txt”)
uFileRead(“/home/testuser/myfile.txt”)
uFileRead(“file:///c:/myFile.txt”)
To read files from a Windows share:
uFileRead(“\\fileserver\freeShare\testfile.txt”)
To read content of a file from HTTP and HTTPS
uFileRead("http://http://www.google.com/search?hl=en&q=pizza&btnG=Google+Search")
uFileRead("https://http://www.google.com/search?hl=en&q=pizza&btnG=Google+Search")
To read content of a file from FTP:
uFileRead("ftp://myUser:myPasswd@myServer/data/myFile.txt")
Allows you to write data to a file. If no URL is given, the data is written to a file write.log in the Sybase IQ ETL log directory.
string uFileWrite(data [, URL] [, append] [, encoding])
The data to be written.
The URL for file access and location.
Flag (0/1) indicating if the data should be appended or not.
The encoding of the target file.
To write data to a file via CIFS:
uFileWrite("hello", "//myServer/myShare/data/test.txt")