All Functions Modules Pages
files

Functions

BOOLEAN files.exists (STRING path)
 Allows to find if a file or folder exists. More...
 
STRING files.cdir ()
 Allows to know the actual work path. More...
 
NIL files.cdir (STRING path)
 Change the work path to the specified path. More...
 
STRING files.fullpath (STRING path)
 Converts and/or revises a relative path, ensuring an absolute path. More...
 
STRING files.nofile (STRING path)
 Remove the file from a specified path. More...
 
STRING files.nopath (STRING path)
 Remove the folder from a specified path. More...
 
NUMBER files.rename (STRING name, STRING new)
 Allows to rename a file or folder. More...
 
NUMBER files.copy (STRING src, STRING dst)
 Copy a file or folder recursively and overwrite the files in the destination folder. More...
 
NUMBER files.move (STRING src, STRING dst)
 Move a file or folder recursively and overwrite the files in the destination folder. More...
 
BOOLEAN files.delete (STRING path)
 Delete a file or folder recursively. More...
 
NIL files.mkdir (STRING path)
 Create a folder. More...
 
NUMBER files.size (STRING path)
 File/Folder Size (Bytes). More...
 
STRING files.sizeformat (NUMBER bytes)
 Converts the numeric size (bytes) into a readable format of units. More...
 
STRING files.ext (STRING path)
 Allows to know the extension of a file. More...
 
TABLE files.list (STRING path)
 List a directory including folders and files. More...
 
TABLE files.listfiles (STRING path)
 List a directory including only files. More...
 
TABLE files.listdirs (STRING path)
 List a directory including only folders. More...
 
TABLE files.scan (STRING src)
 Gets a content list of a compressed file (zip/vpk or rar). More...
 
TABLE files.scan (STRING src, NUMBER checkvpk)
 Gets a content list of a compressed file (zip or rar). More...
 
STRING files.extractbuffer (STRING src, STRING filename)
 Extracts an specific file inside a compressed file zip to RAM. More...
 
STRING files.extractbuffer (STRING src, STRING filename, STRING pass)
 Extracts an specific file inside a compressed file zip to RAM. More...
 
STRING files.extractbuffer (STRING src, NUMBER offset)
 Extracts an specific file inside a compressed file zip to RAM. More...
 
STRING files.extractbuffer (STRING src, NUMBER offset, STRING pass)
 Extracts an specific file inside a compressed file zip to RAM. More...
 
NUMBER files.extractfile (STRING src, STRING filename, STRING dst)
 Extracts an specific file inside a compressed file (zip or rar). More...
 
NUMBER files.extractfile (STRING src, STRING filename, STRING dst, STRING pass)
 Extracts an specific file inside a compressed file (zip or rar). More...
 
NUMBER files.extract (STRING src, STRING dst)
 Function for extracting files in .zip and .rar. More...
 
NUMBER files.extract (STRING src, STRING dst, STRING pass)
 Function for extracting files in .zip and .rar. More...
 
NUMBER files.extract (STRING src, STRING dst, NUMBER totalsize)
 Function for extracting files in zip/vpk and rar. More...
 
NUMBER files.extract (STRING src, STRING dst, STRING pass, NUMBER totalsize)
 Function for extracting files in zip/vpk and rar. More...
 
NUMBER files.makezip (STRING namezip, STRING src)
 Function to compress files (format .zip) More...
 
NUMBER files.makezip (STRING namezip, STRING src, STRING pass)
 Function to compress files (format .zip) More...
 
NUMBER files.makezip (STRING namezip, STRING src, NUMBER level)
 Function to compress files (format .zip) More...
 
NUMBER files.makezip (STRING namezip, STRING src, STRING pass, NUMBER level)
 Function to compress files (format .zip) More...
 
NUMBER files.export (STRING path)
 Allows multimedia files to be exported (Image and Audio files). More...
 
NUMBER files.type (STRING path)
 Allows to know the file type. More...
 

Detailed Description

File managing.

Function Documentation

BOOLEAN files.exists ( STRING  path)

Allows to find if a file or folder exists.

Parameters
pathPath of the file or folder.
Returns
true/false Depending on whether the file/folder exists.
STRING files.cdir ( )

Allows to know the actual work path.

Returns
The path of our actual directory.
NIL files.cdir ( STRING  path)

Change the work path to the specified path.

Parameters
pathThe new work path.
Returns
Nothing.
STRING files.fullpath ( STRING  path)

Converts and/or revises a relative path, ensuring an absolute path.

Parameters
pathThe relative path.
Returns
The absolute path.
STRING files.nofile ( STRING  path)

Remove the file from a specified path.

Parameters
pathThe path of the file/folder.
Returns
The path name without file.
STRING files.nopath ( STRING  path)

Remove the folder from a specified path.

Parameters
pathThe path of the file/folder.
Returns
The filename.
NUMBER files.rename ( STRING  name,
STRING  new 
)

Allows to rename a file or folder.

Parameters
nameThe path of the file/folder.
newThe new name of the file/folder.
Returns
1 if success, 0 otherwise.
NUMBER files.copy ( STRING  src,
STRING  dst 
)

Copy a file or folder recursively and overwrite the files in the destination folder.

Parameters
srcThe path of the file/folder to copy.
dstThe path of the folder destination.
Note
This function can use the onCopyFiles() callback, more info here .
Returns
1 if success, 0 otherwise.
NUMBER files.move ( STRING  src,
STRING  dst 
)

Move a file or folder recursively and overwrite the files in the destination folder.

Parameters
srcThe path of the file/folder to move.
dstThe path of the folder destination.
Note
If the destination file or path does not exist, the directory will be created.
Returns
1 if success, 0 otherwise.
BOOLEAN files.delete ( STRING  path)

Delete a file or folder recursively.

Parameters
pathThe path of the file/folder.
Returns
true if success, false otherwise.
Note
All folders and files included will be deleted.
This function can use the onDeleteFiles() callback, more info here .
NIL files.mkdir ( STRING  path)

Create a folder.

Parameters
pathPath of the folder to create.
Returns
Nothing.
NUMBER files.size ( STRING  path)

File/Folder Size (Bytes).

Parameters
pathFile/Folder Path.
Returns
The file/folder size in bytes.
STRING files.sizeformat ( NUMBER  bytes)

Converts the numeric size (bytes) into a readable format of units.

Parameters
bytesThe size bytes.
Returns
A string with the number of units ("B", "KB", "MB", "GB", "TB").
STRING files.ext ( STRING  path)

Allows to know the extension of a file.

Parameters
pathFile Path
Returns
file extension.
TABLE files.list ( STRING  path)

List a directory including folders and files.

Parameters
pathDirectory path.
Returns
A table with these fields:
  • name: file or folder name(STRING).
  • path: Full path of the file or folder(STRING).
  • ctime: The date of creation of the file or folder (STRING).
  • atime: The date when last access of the file or folder (STRING).
  • mtime: The date when last modification of the file or folder (STRING).
  • mode: Those Are the access rights in the following order: "R" for Reading, "W" for Writing and "X" for Executable. In case of not having access will be displayed as follows: "---".
  • size: size in bytes, only for files (NUMBER).
  • directory: true/false depending on whether the field is a directory or not (BOOLEAN).
  • ext: File extension, if available (STRING).
Note
If an error occurs will not generate the table, will return nil.
TABLE files.listfiles ( STRING  path)

List a directory including only files.

Parameters
pathDirectory path.
Returns
A table with these fields:
  • name: filename(STRING).
  • path: Full path of the file (STRING).
  • ctime: The date of creation of the file(STRING).
  • atime: The date when last access of the file (STRING).
  • mtime: The date when last modification of the file (STRING).
  • mode: Those Are the access rights in the following order: "R" for Reading, "W" for Writing and "X" for Executable. In case of not having access will be displayed as follows: "---".
  • size: size in bytes (NUMBER).
  • ext: File extension, if available (STRING).
Note
If an error occurs will not generate the table, will return nil.
TABLE files.listdirs ( STRING  path)

List a directory including only folders.

Parameters
pathDirectory path.
Returns
A table with these fields:
  • name: folder name(STRING).
  • path: Full path of the folder(STRING).
  • ctime: The date of creation of the folder (STRING).
  • atime: The date when last access of the folder (STRING).
  • mtime: The date when last modification of the folder (STRING).
  • mode: Those Are the access rights in the following order: "R" for Reading, "W" for Writing and "X" for Executable. In case of not having access will be displayed as follows: "---".
Note
If an error occurs will not generate the table, will return nil.
TABLE files.scan ( STRING  src)

Gets a content list of a compressed file (zip/vpk or rar).

Parameters
srcPath to the compressed file.
Returns
A table with these fields:
  • name: Filename (including the folder name if the file is inside it) (STRING).
  • size: Uncompressed file size in bytes. (NUMBER).
  • pos: Offset of file (NUMBER).
  • unsafe: Determines if a vpk is flagged as unsafe or dangerous (NUMBER).
  • -1 (This value is returned when the function for checking the files in the vpk was not activated or if it failed ckecking a file).
  • 0 (Safe).
  • 1 (Unsafe).
  • 2 (Dangerous).
  • realsize: Total decompression size in bytes. (NUMBER).
Note
  • In case of error returns nil.
  • This function can use the onScanningFiles() callback, more info here .
  • The sub-index 'pos' only appears in the case of the zip.
  • The sub-index 'unsafe' only appears in the case of the vpk.
  • realsize Is an index of the table not a sub-index of each content.
TABLE files.scan ( STRING  src,
NUMBER  checkvpk 
)

Gets a content list of a compressed file (zip or rar).

Parameters
srcPath to the compressed file.
checkvpkColocar el valor de 1, si deseas revisar los archivos dentro de un vpk para conocer si es Inseguro/Peligroso.
Returns
A table with these fields:
  • name: Filename (including the folder name if the file is inside it) (STRING).
  • size: Uncompressed file size in bytes. (NUMBER).
  • pos: Offset of file (NUMBER).
  • unsafe: Determines if a vpk is flagged as unsafe or dangerous (NUMBER).
  • -1 (This value is returned when the function for checking the files in the vpk was not activated or if it failed ckecking a file).
  • 0 (Safe).
  • 1 (Unsafe).
  • 2 (Dangerous).
  • realsize: Total decompression size in bytes. (NUMBER).
Note
  • In case of error returns nil.
  • This function can use the onScanningFiles() callback, more info here .
  • The sub-index 'pos' only appears in the case of the zip.
  • The sub-index 'unsafe' only appears in the case of the vpk.
  • realsize Is an index of the table not a sub-index of each content.
STRING files.extractbuffer ( STRING  src,
STRING  filename 
)

Extracts an specific file inside a compressed file zip to RAM.

Parameters
srcPath to the compressed file.
filenameFile to extract (can be easily obtained using files.scan()).
Returns
a string with the data, nil otherwise.
STRING files.extractbuffer ( STRING  src,
STRING  filename,
STRING  pass 
)

Extracts an specific file inside a compressed file zip to RAM.

Parameters
srcPath to the compressed file.
filenameFile to extract (can be easily obtained using files.scan()).
passKey or Password if required.
Returns
a string with the data, nil otherwise.
STRING files.extractbuffer ( STRING  src,
NUMBER  offset 
)

Extracts an specific file inside a compressed file zip to RAM.

Parameters
srcPath to the compressed file.
offsetIs the position of the file in the tablet (can be easily obtained using files.scan()).
Returns
a string with the data, nil otherwise.
STRING files.extractbuffer ( STRING  src,
NUMBER  offset,
STRING  pass 
)

Extracts an specific file inside a compressed file zip to RAM.

Parameters
srcPath to the compressed file.
offsetIs the position of the file in the tablet (can be easily obtained using files.scan()).
passKey or Password if required.
Returns
a string with the data, nil otherwise.
NUMBER files.extractfile ( STRING  src,
STRING  filename,
STRING  dst 
)

Extracts an specific file inside a compressed file (zip or rar).

Parameters
srcPath to the compressed file.
filenameFile to extract (can be easily obtained using files.scan()).
dstPath where the file will be extracted.
Note
  • This function can use the onExtractFiles() callback, more info here .
  • If the destination path doesn't exist, will be automatically created.
Returns
1 if success, 0 otherwise.
NUMBER files.extractfile ( STRING  src,
STRING  filename,
STRING  dst,
STRING  pass 
)

Extracts an specific file inside a compressed file (zip or rar).

Parameters
srcPath to the compressed file.
filenameFile to extract (can be easily obtained using files.scan()).
dstPath where the file will be extracted.
passKey or Password if required.
Note
  • This function can use the onExtractFiles() callback, more info here .
  • If the destination path doesn't exist, will be automatically created.
Returns
1 if success, 0 otherwise.
NUMBER files.extract ( STRING  src,
STRING  dst 
)

Function for extracting files in .zip and .rar.

Parameters
srcIs the path of the file to extract.
dstIs the path where the files will be extracted.
Note
  • This function can use the onExtractFiles() callback, more info here .
  • If the destination path doesn't exist, will be automatically created.
Returns
1 if success, 0 otherwise.
NUMBER files.extract ( STRING  src,
STRING  dst,
STRING  pass 
)

Function for extracting files in .zip and .rar.

Parameters
srcIs the path of the file to extract.
dstIs the path where the files will be extracted.
passKey or Password if required.
Note
  • This function can use the onExtractFiles() callback, more info here .
  • If the destination path doesn't exist, will be automatically created.
Returns
1 if success, 0 otherwise.
NUMBER files.extract ( STRING  src,
STRING  dst,
NUMBER  totalsize 
)

Function for extracting files in zip/vpk and rar.

Parameters
srcIs the path of the file to extract.
dstIs the path where the files will be extracted.
totalsizeTotal uncompressed size in bytes (can be easily obtained using files.scan()).
Note
  • This function can use the onExtractFiles() callback, more info here .
  • If the destination path doesn't exist, will be automatically created.
Returns
1 if success, 0 otherwise.
NUMBER files.extract ( STRING  src,
STRING  dst,
STRING  pass,
NUMBER  totalsize 
)

Function for extracting files in zip/vpk and rar.

Parameters
srcIs the path of the file to extract.
dstIs the path where the files will be extracted.
passKey or Password if required.
totalsizeTotal uncompressed size in bytes (can be easily obtained using files.scan()).
Note
  • This function can use the onExtractFiles() callback, more info here .
  • If the destination path doesn't exist, will be automatically created.
Returns
1 if success, 0 otherwise.
NUMBER files.makezip ( STRING  namezip,
STRING  src 
)

Function to compress files (format .zip)

Parameters
namezipThe name of the file .zip (example: myfile.zip)
srcThe path of the file/folder to be compressed. It can also be a table with many files/folders to be compressed.
Note
  • Default is compressed with Default Compression.
  • This function can use the onCompressZip() callback, more info here .
  • If the destination file or path does not exist, the directory will be created.
Returns
1 if success, 0 otherwise.
NUMBER files.makezip ( STRING  namezip,
STRING  src,
STRING  pass 
)

Function to compress files (format .zip)

Parameters
namezipThe name of the file .zip (example: myfile.zip)
srcThe path of the file/folder to be compressed. It can also be a table with many files/folders to be compressed.
passThe key or password to create a protected .zip.
Note
  • Default is compressed with Default Compression.
  • This function can use the onCompressZip() callback, more info here .
  • If the destination file or path does not exist, the directory will be created.
Returns
1 if success, 0 otherwise.
NUMBER files.makezip ( STRING  namezip,
STRING  src,
NUMBER  level 
)

Function to compress files (format .zip)

Parameters
namezipThe name of the file .zip (example: myfile.zip)
srcThe path of the file/folder to be compressed. It can also be a table with many files/folders to be compressed.
levelCompression Level:
  • __NCOMPRESS (NO COMPRESSION)
  • __SPEED (BEST SPEED)
  • __BCOMPRESS (BEST COMPRESSION)
  • __DCOMPRESS (DEFAULT COMPRESSION)
Note
  • Default is compressed with Default Compression.
  • This function can use the onCompressZip() callback, more info here .
  • If the destination file or path does not exist, the directory will be created.
Returns
1 if success, 0 otherwise.
NUMBER files.makezip ( STRING  namezip,
STRING  src,
STRING  pass,
NUMBER  level 
)

Function to compress files (format .zip)

Parameters
namezipThe name of the file .zip (example: myfile.zip)
srcThe path of the file/folder to be compressed. It can also be a table with many files/folders to be compressed.
passThe key or password to create a protected .zip.
levelCompression Level:
  • __NCOMPRESS (NO COMPRESSION)
  • __SPEED (BEST SPEED)
  • __BCOMPRESS (BEST COMPRESSION)
  • __DCOMPRESS (DEFAULT COMPRESSION)
Note
  • This function can use the onCompressZip() callback, more info here .
  • If the destination file or path does not exist, the directory will be created.
Returns
1 if success, 0 otherwise.
NUMBER files.export ( STRING  path)

Allows multimedia files to be exported (Image and Audio files).

Parameters
pathIs the path of the file to be exported. (Audio: mp3, Image: jpg, png).
Returns
1 if success, 0 otherwise.
NUMBER files.type ( STRING  path)

Allows to know the file type.

Parameters
pathIs the path to the file.
Returns
A numeric value between the following:
  • 0 Unknown
  • 1 EBOOT.PBP
  • 2 ISO
  • 3 CSO
  • 4 DAX
  • 5 ZIP/VPK
  • 6 SFO