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 installation path of WingFTP

 

Remarks

Returns the absolute path where Wing FTP Server is installed.

 


c_IsDir(string strPath)

 

Parameters

[1]string   the directory path

 

Return Values

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

 

Remarks

Check whether the path is a directory.

 


c_MkDir(string strPath)

 

Parameters

[1]string   the directory path

 

Return Values

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

 

Remarks

Make a directory.

 


c_RemoveFileDir(string strPath)

 

Parameters

[1]string   the file/directory path

 

Return Values

[1]bool  return true if removing a file or folder successfully, otherwise return false

 

Remarks

Remove a file or directory.

 


c_MoveFileDir(string strOldPath, string strNewPath)

 

Parameters

[1]string   the source path

[2]string   the destination path

 

Return Values

[1]bool  return true if moving a file or folder successfully, otherwise return false

 

Remarks

Move/Rename a file or directory.

 


c_CopyFileDir(string strOldPath, string strNewPath)

 

Parameters

[1]string   the source path

[2]string   the destination path

 

Return Values

[1]bool  return true if copying a file or folder successfully, otherwise return false

 

Remarks

Copy a file or directory.

 


c_FileExist(string strPath)

 

Parameters

[1]string   the file path

 

Return Values

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

 

Remarks

Check whether a regular file exists.

 


c_GetFileTime(string strPath)

 

Parameters

[1]string   the file path

 

Return Values

[1]int   the file modify time

 

Remarks

Get the time when the file was modified

 


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.

 


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 .