Home
SQL File Import online help Prev Page Prev Page
Introduction
About SQL File Import
Version history
Contact us
Supported database engines
Using SQL File Import
Home page
Task Wizard
Select source data
Files as source data
CSV source data files
Excel source data files
Enter file search patterns
Connect to database
Conecting to databases directly without client libraries installed
Connecting to an Oracle database
Database scripts
Select table to upload into
Map data to table columns
Review script results
Transaction options
Logging options
Finalise
Run task
Scheduling a task
Options
Scripting
Global variables
OnBeforeUpload function
OnAfterUpload function
Support functions
Data functions
Log functions
String functions
Date and time functions
Date-Time format strings
File functions

File functions

 
function FileSize(FileName: string): Integer;  
Returns the size of the file.  
 
function FileExists(FileName: string): Boolean;  
Checks if the file exists.  
 
function ExtractFileName(FileName: string): string;  
Returns the file name portion of the entered name. E.g. ExtractFileName('d:\temp\myfile.txt') returns 'myfile.txt'.  
 
function ExtractFilePath(FileName: string): string;  
Returns the file path portion of the entered name. E.g. ExtractFileName('d:\temp\myfile.txt') returns 'd:\temp\'.  
 
function ReplaceFilePath(FileName: string; NewExtension: string): string;  
Replaces the current path with the new path. E.g. ReplaceFileExt('d:\temp\myfile.txt', 'g:\uploads\') returns 'g:\uploads\myfile.txt'.  
 
function ExtractFileExt(FileName: string): string;  
Returns the file extension of the entered name. E.g. ExtractFileName('d:\temp\myfile.txt') returns '.txt'.  
 
function ReplaceFileExt(FileName, NewExtension: string): string;  
Returns the file name replaced with the new extension. E.g. ReplaceFileExt('d:\temp\myfile.doc', '.zip') returns 'd:\temp\myfile.zip'  
 
function CopyFile(Source: string; Target: string; OverwriteExisting: Boolean = False): Boolean;  
Copies the Source file to the Target name. Returns True if the operation succeeds.  
 
function MoveFile(Source: string; TargetFolder: string; OverwriteExisting: Boolean = False): Boolean;  
Moves the Source file to the TargetFolder folder. Returns True if the operation succeeds.  
 
function DeleteFile(FileName: string): Boolean;  
Deletes the specified file. Returns True if the operation succeeds.  
 
function DirectoryExists(Directory: string): Boolean;  
Checks if the Directory folder exists.  
 
function CreateDirectory(Directory: string): Boolean;  
Creates the Directory folder. All upper level folders must already exist. Otherwise, use the ForceDirectories function.  
 
function ForceDirectories(Directory: string): Boolean;  
Creates the Directory folder and all upper level folders where required.  
 
function GetFileCreationTimestamp(FileName: string): string;  
Returns the timestamp FileName was created. See this topic on how to convert the timestamp value to string representations.  
 
function GetFileLastWriteTimestamp(FileName: string): string;  
Returns the timestamp FileName was last modified. See this topic on how to convert the timestamp value to string representations.  
 
function CompressFile(FileName: string; ArchiveFileName: string; CompressionLevel: Integer; var Error: string): Boolean;  
Compresses the file and stores it in the named archive file. If the ArchiveFileName has the 'zip' extension, a zip archive is created. If the ArchiveFileName has the '7z' extension, a 7-zip archive is created. In most cases, 7-zip archives offer better compression that zip archives. Compression levels can have the values 0 (no compression) to 9 (maximum compression). Returns True if the operation succeeds. If the operation fails, the error message is returned in the Error parameter.  
 
function CompressFileWithPassword(FileName: string; ArchiveFileName: string; CompressionLevel: Integer; Password: string; var Error: string): Boolean;  
Similar to the above, but protects the archive with the entered Password.  
 
function GetFileContentAsText(FileName: string): string;  
Returns the contents as a file in a text string. This is useful when you want to upload files/columns containing plain text into a text field.