main fs service class
More...
Inherits QorusSystemService.
|
nothing | rename (string source, string target, softbool man=False) |
| rename/move a file More...
|
|
nothing | rename_conn (string conn_src, string source, string conn_tgt, string target, softbool man=False) |
| rename/move a file More...
|
|
nothing | _copy (string source, string target) |
| copy a file More...
|
|
nothing | copy_conn (string conn_src, string source, string conn_tgt, string target) |
| copy a file More...
|
|
nothing | del (string path) |
| delete a file More...
|
|
nothing | del_conn (string conn, string path) |
| delete a file More...
|
|
list | ls (string path, *string regex, *softint reopts, *string encoding) |
| lists files in the given directory More...
|
|
list | ls_conn (string conn, *string path, *string regex, *softint reopts, *string encoding) |
| lists files in the given directory More...
|
|
binary | get_file_bin (string path) |
| returns the given file as binary data More...
|
|
binary | get_file_bin_conn (string conn, string path) |
| returns the given file as binary data More...
|
|
string | get_file_string (string path, *string encoding) |
| returns the given file as string data More...
|
|
string | get_file_string_conn (string conn, string path, *string encoding) |
| returns the given file as string data More...
|
|
nothing | write_file (string path, data data, int mode=0664, *string encoding) |
| writes the input data to the given location More...
|
|
nothing | write_file_conn (string conn, string path, data data, int mode=0664, *string encoding) |
| writes the input data to the given location More...
|
|
*hash | hstat_file (string path) |
| runs Qore::hstat() on a file target and returns the result More...
|
|
*hash | hstat_file_conn (string conn, string path) |
| runs Qore::hstat() on a file target and returns the result More...
|
|
◆ _copy()
copy a file
- Parameters
-
source | the source path |
target | the target path |
If any errors occur, an exception is thrown
- Exceptions
-
COPY-ERROR | cannot stat() source file |
◆ copy_conn()
copy a file
- Parameters
-
conn_src | the source user connection name |
source | the source path, relative to conn_src |
conn_tgt | the target user connection name |
target | the target path, relative to conn_tgt |
If any errors occur, an exception is thrown
- Exceptions
-
CONNECTION-ERROR | the given connection is not known |
COPY-ERROR | cannot stat() source file |
FS-USER-CONNECTION-ERROR | the given connection is not a filesystem connection |
◆ del()
nothing fs::del |
( |
string |
path | ) |
|
|
inline |
delete a file
- Parameters
-
path | the path of the file to delete |
If any errors occur, an exception is thrown
- Exceptions
-
UNLINK-ERROR | error removing the file |
◆ del_conn()
delete a file
- Parameters
-
conn | an user connection name |
path | the path of the file to delete, relative to conn |
If any errors occur, an exception is thrown
- Exceptions
-
CONNECTION-ERROR | the given connection is not known |
FS-USER-CONNECTION-ERROR | the given connection is not a filesystem connection |
UNLINK-ERROR | error removing the file |
◆ get_file_bin()
returns the given file as binary data
- Parameters
-
path | the path of the file to retrieve |
- Returns
- the file data as binary data
◆ get_file_bin_conn()
returns the given file as binary data
- Parameters
-
conn | an user connection name |
path | the path of the file to retrieve, relative to conn |
- Returns
- the file data as binary data
- Exceptions
-
CONNECTION-ERROR | the given connection is not known |
FS-USER-CONNECTION-ERROR | the given connection is not a filesystem connection |
◆ get_file_string()
returns the given file as string data
- Parameters
-
path | the path of the file to retrieve |
encoding | the encoding of the source file |
- Returns
- the file data as a string
◆ get_file_string_conn()
returns the given file as string data
- Parameters
-
conn | anuser connection |
path | the path of the file to retrieve |
encoding | the encoding of the source file |
- Returns
- the file data as a string
- Exceptions
-
CONNECTION-ERROR | the given connection is not known |
FS-USER-CONNECTION-ERROR | the given connection is not a filesystem connection |
◆ hstat_file()
◆ hstat_file_conn()
runs Qore::hstat() on a file target and returns the result
- Parameters
-
conn | a user connection; must be a filesystem connection |
path | the path of the file to stat |
- Returns
- NOTHING or a StatInfo file status value hashes for the path argument
- Exceptions
-
CONNECTION-ERROR | the given connection is not known |
FS-USER-CONNECTION-ERROR | the given connection is not a filesystem connection |
- See also
- Qore::hstat()
◆ ls()
lists files in the given directory
- Parameters
-
path | the path to list |
regex | an optional regex to filter the results |
reopts | option regular expression options; see Regular Expression Constants for possible values |
encoding | the encoding of the filesystem string data |
- Returns
- a list of StatInfo file status value hashes for each matched file plus a
"name"
key with the file or directory name and optionally a "link"
key for symbolic link targets
- Exceptions
-
DIR-ERROR | directory does not exist |
◆ ls_conn()
lists files in the given directory
- Parameters
-
conn | an user connection name |
path | the path to list, relative to conn. It can be empty, then the toplevel connection directory is listed. |
regex | an optional regex to filter the results |
reopts | option regular expression options; see Regular Expression Constants for possible values |
encoding | the encoding of the filesystem string data |
- Returns
- a list of StatInfo file status value hashes for each matched file plus a
"name"
key with the file or directory name and optionally a "link"
key for symbolic link targets
- Exceptions
-
CONNECTION-ERROR | the given connection is not known |
DIR-ERROR | directory does not exist |
FS-USER-CONNECTION-ERROR | the given connection is not a filesystem connection |
◆ rename()
rename/move a file
- Parameters
-
source | the source path |
target | the target path |
man | rename the file manually by copying the file's data and then deleting the source file, this is sometimes necessary on some OSes when renaming files across filesystem boundaries |
If any errors occur, an exception is thrown
- Exceptions
-
RENAME-ERROR | cannot stat() source file |
◆ rename_conn()
rename/move a file
- Parameters
-
conn_src | the source user connection name |
source | the source path, relative to conn_src |
conn_tgt | the target user connection name |
target | the target path, relative to conn_tgt |
man | rename the file manually by copying the file's data and then deleting the source file, this is sometimes necessary on some OSes when renaming files across filesystem boundaries |
If any errors occur, an exception is thrown
- Exceptions
-
CONNECTION-ERROR | the given connection is not known |
FS-USER-CONNECTION-ERROR | the given connection is not a filesystem connection |
RENAME-ERROR | cannot stat() source file |
◆ write_file()
nothing fs::write_file |
( |
string |
path, |
|
|
data |
data, |
|
|
int |
mode = 0664 , |
|
|
*string |
encoding |
|
) |
| |
|
inline |
writes the input data to the given location
- Parameters
-
path | the path of the file to write |
data | the file data to write |
mode | the file's creation mode |
encoding | the encoding of the target file |
◆ write_file_conn()
writes the input data to the given location
- Parameters
-
conn | a user connection |
path | the path of the file to write, relative to conn |
data | the file data to write |
mode | the file's creation mode |
encoding | the encoding of the target file |
- Exceptions
-
CONNECTION-ERROR | the given connection is not known |
FS-USER-CONNECTION-ERROR | the given connection is not a filesystem connection |
The documentation for this class was generated from the following file: