File Operation Functions : Function Index

Description :  File related functions can be used to validate / retrieve details of the file present in the server machine where QEngine runs.

Where to use File related Functions ?

Following are the place where the File related Functions,
How to insert the File related Functions in the script ?

Following are the various functions available in the "File Operations" category,
  1. compareFile
  2. getFileCount
  3. getFileSize
  4. getLinesInFile
  5. getStringCountInFile
  6. isFileInZip
  7. isStringInFile
  8. isStringInZip


compareFile

Function Description:

 Use this utility function to compare content of the two files. This function will compare two files present in the server system where QEngine runs and if it find both are similar, it will return 0.

 How to Define:

compareFile("baseFileName","CheckFileName")

The files will be verified for its content, date/time of creation and if all matches then only it will return Success.


 Example:


          compareFile("C:\test\masterfile.csv","C:\test\checkfile.csv")


 Return Value:

0 for Success

1 for Failure

Top


getFileCount

Function Description:

Use this utility function to get number of files / directory identified by a keyword, present under the given directory in the server system where QEngine runs. This will return the obtained count.

How to Define:

getFileCount("Directory_Path","FILE_TYPE")

Directory_Path = The full path of the directory in the server system from where file count has to be obtained.

FILE_TYPE = The file type states which type of file has to be counted
                        
ONLY_FILES = To get only the number of files present in given directory
                         ONLY_DIRECTORY = To get only the number of directories present in given directory
                         FILES_AND_DIRECTORY == To get the file count including both Files and Directories.

Example:

count = getFileCount("c:\test\mytest\","FILES_AND_DIRECTORY")

In the above case,

The number of files matches the files and directory file types will be counted and  the count will be returned and assigned to "count" variable.

Return Value:

Integer - Count of file matching the "FILE_TYPE" given in the second argument.

Top


getFileSize

 Function Description:

 Use this utility function to get the size of the file present in the server system where QEngine runs in bytes.

 How to Define:

size = getFileSize("filename")

In the above case,

The size of the given file in bytes will be retrieved and stored in the "size" variable.


 Example:


          size = getFileSize("C:\test\MyPhoto.gif")
          displayMessage(size)


 Return Value:

 Integer - size of the file in bytes.

 Top


getLinesInFile

 Function Description:

 Use this utility function to get total number of lines present in the file with given filename in the server system where QEngine runs.

 How to Define:

linecount = getLinesInFile("filename")

In the above case,

The total number of lines present in the file with given file name will be retrieved and will be assigned to linecount to use it in further down the script.


 Example:


          linecount = getLinesinFile("C:\test\MyFile.txt")

          displayMessage(linecount)


 Return Value:

 Integer

 Top


getStringCountInFile

 Function Description:

 Use this utility function to get the number of occurrences of the specified search string in the file with the given file name in the server system where QEngine runs.

 How to Define:

 getStringCountInFile("fileName","search_string")

 Example:


          count = getStringCountInFile("C:\test\MyFile.txt","QEngine")

          displayMessage(count)


Return Value:

 Integer - Number of occurence of the given search_string.

 Top


isFileInZip

 Function Description:

Use this utility function to check whether the file with the given file name exists in the zip file with given zip file name.

 How to Define:

 isFileInZip("ZipFile","FileName")

 Example:


          isFileInZip("C:\test\MyZip.zip","MyFile.txt")

 

Return Value:

0 for Success

1 for Failure

 Top


isStringInFile

 Function Description:

 Use this utility function to check whether the given search string exists in the file with the given file name.

 How to Define:

 isStringInFile("Search_String","FileName")

Example:


          isStringInFile("QEngine","C:\test\MyFile.txt")

 
Return Value:

0 for Success

1 for Failure

 Top


isStringInZip

 Function Description:

 Use this utility function to check whether the given search string exists in the file with the given file name where the file exists in the given zip file.

 How to Define:

 isStringInZip("ZipFile","FileName","Search_String")

Example:


          isStringInZip("QEngine","MyFile.txt","C:\test\MyZip.zip")


 Return Value:

0 for Success

1 for Failure

 Top


 



Copyright © 1999, AdventNet Inc. All Rights Reserved.