Navigation:  Advanced Features > Server Lua API >

Miscellaneous

Previous pageReturn to chapter overviewNext page

 

md5(string strText)

 

Parameters

[1]string   the original string

 

Return Values

[1]string   the md5 hash of a string

 

Remarks

Calculate the md5 hash of a string.

 


c_GetAppPath()

 

Parameters

nil

 

Return Values

[1]string   the application installation path

 

Remarks

Returns the absolute path where Wing FTP Server is installed.

 


c_IsDir(string strDirPath)

 

Parameters

[1]string   the directory path

 

Return Values

[1]bool  return true if strDirPath is an existing directory, otherwise return false

 

Remarks

Tells whether the path is a real directory.

 


c_MkDir(string strDirPath)

 

Parameters

[1]string   the directory path

 

Return Values

[1]bool  return true if created a directory successfully, otherwise return false

 

Remarks

Attempts to make a directory specified by strPath.

 


c_RemoveFileDir(string strPath)

 

Parameters

[1]string   the directory path

 

Return Values

[1]bool  return true if removed a file or a directory successfully, otherwise return false

 

Remarks

Attempts to remove a file or directory specified by strPath.

 


c_FileExist(string strFilePath)

 

Parameters

[1]string   the file path

 

Return Values

[1]bool  return true if strFilePath is a regular file, otherwise return false

 

Remarks

Check whether a regular file exists.

 


c_GetFileTime(string strFilePath)

 

Parameters

[1]string   the file path

 

Return Values

[1]int   the time when file content was changed

 

Remarks

Get the time when file content was changed.

 


c_GetTimeMS()

 

Parameters

nil

 

Return Values

[1]int   the milliseconds of current time

 

Remarks

Get the milliseconds of current time.

 


c_GetTimeUS()

 

Parameters

nil

 

Return Values

[1]int   the microseconds of current time

 

Remarks

Get the microseconds of current time.

 


c_GetRandom()

 

Parameters

nil

 

Return Values

[1]int   the random number

 

Remarks

Generate a system random number.

 


c_GetDir(string strDirPath)

 

Parameters

[1]string   the directory path

 

Return Values

[1]string   return an iterative directory name when no exception occurred, otherwise return nil.

 

Remarks

Returns an iterative directory name inside the specified path strDirPath. So you can use this function for directory traversal,

for example:

for subdir in c_GetDir(rootpath) do

 print(subdir)

end

 


c_GetFileDir(string strDirPath)

 

Parameters

[1]string   the directory path

 

Return Values

[1]string   return an iterative directory/file name when no exception occurred, otherwise return nil.

 

Remarks

Returns an iterative directory/file name inside the specified path strDirPath. So you can use this function for directory/file traversal,

for example:

for subdirfile in c_GetFileDir(rootpath) do

 print(subdirfile)

end

 


c_GetRootDir()

 

Parameters

nil

 

Return Values

[1]table   a table list of local drivers in windows, and in other OS its subdirectory table under "/"

 

Remarks

Return local drivers string table in windows, subdirectory table under "/" in other OS.

for example:

for _,root_sub in pairs(c_GetRootDir()) do

 if root_sub ~= nil and root_sub["isdir"] == true then

   print(root_sub["dir"])

 end

end

 


c_GetLocalIpList()

 

Parameters

nil

 

Return Values

[1]string   the local IP list string

 

Remarks

Returns the local IP list, and IP in string is separated with a comma sign.

 


c_TranslateTime(string strTime)

 

Parameters

[1]string   the time string, such as "2009-09-09 00:00:00"

 

Return Values

[1]int  time_t value of the time

 

Remarks

Translate a time string to a time_t value .