Qore Programming Language Reference Manual 1.18.1
Loading...
Searching...
No Matches
QC_Dir.dox.h
1
3namespace Qore {
5
7hashdecl DirStatInfo {
13 int blocks;
17 int dev;
19 int gid;
21 int inode;
23 *string link;
25 int mode;
29 string name;
31 int nlink;
33 string perm;
35 int rdev;
37 int size;
39 string type;
41 int uid;
42};
43}
44
46namespace Qore {
48
57class Dir {
58
59public:
61
78bool chdir(string path);
79
80public:
82
99nothing chgrp(int gid);
100
101public:
103
121nothing chgrp(string groupname);
122
123public:
125
139nothing chmod(softint mode);
140
141public:
143
160nothing chown(int uid);
161
162public:
164
182nothing chown(string username);
183
184public:
186
195 constructor(*string encoding);
196
197public:
199
205
206public:
208
226int create(softint mode = 0777);
227
228public:
230
238bool exists();
239
240public:
242
258hash<StatInfo> hstat();
259
260public:
262
282list<auto> list(bool full = False);
283
284public:
286
312list<auto> list(string regex, softint regex_options = 0, softbool full = False);
313
314public:
316
338list<auto> listDirs(bool full = False);
339
340public:
342
368list<auto> listDirs(string regex, softint regex_options = 0, softbool full = False);
369
370public:
372
394list<auto> listFiles(bool full = False);
395
396public:
398
424list<auto> listFiles(string regex, softint regex_options = 0, softbool full = False);
425
426public:
428
443nothing mkdir(string subdir, softint mode = 0777);
444
445public:
447
459Dir openDir(string subdir, *string encoding);
460
461public:
463
480File openFile(string filename, int flags = O_RDONLY, int mode = 0666, *string encoding);
481
482public:
484
493*string path();
494
495public:
497
515bool removeFile(string file);
516
517public:
519
535nothing rmdir(string subdir);
536
537public:
539
555list<auto> stat();
556
557public:
559
576hash<FilesystemInfo> statvfs();
577};
578}
This class implements directory handling, file listing, creating/removing subdirectories,...
Definition: QC_Dir.dox.h:57
nothing chown(string username)
Change the ownership of the directory from the username.
File openFile(string filename, int flags=O_RDONLY, int mode=0666, *string encoding)
Create and open a File object in the current directory of the Dir object.
list< auto > stat()
Returns a list of file status information for the current directory.
list< auto > listFiles(string regex, softint regex_options=0, softbool full=False)
Retrieves all files in the directory that match the given regular expression; if any errors occur an ...
nothing chgrp(int gid)
Change the group membership of the directory from the group id.
bool removeFile(string file)
Remove the file with the given name in the Dir object's directory.
nothing rmdir(string subdir)
Removes a direct subdirectory from the Dir object's current path.
Dir openDir(string subdir, *string encoding)
Get a Dir object as an subdir entry of the current directory.
list< auto > listFiles(bool full=False)
Retrieves all files in this directory; if any errors occur an exception is thrown.
hash< FilesystemInfo > statvfs()
Returns a FilesystemInfo hash for the current directory.
bool chdir(string path)
Changes the current directory of the Dir object to the path given.
bool exists()
Returns True if the path in the Dir object points to a directory that already exists and is openable ...
list< auto > listDirs(string regex, softint regex_options=0, softbool full=False)
Gets all subdirectory entries in the directory that match the given regular expression (except "....
constructor(*string encoding)
Creates the Directory object.
list< auto > list(string regex, softint regex_options=0, softbool full=False)
Gets all entries in the directory that match the given regular expression (except "....
list< auto > list(bool full=False)
Get all entries in this directory, except "." and ".." directories; if any errors occur an exception ...
nothing chown(int uid)
Change the ownership of the directory from the userid.
int create(softint mode=0777)
Creates the directory tree the Dir object points to, if it does not exist.
hash< StatInfo > hstat()
Returns a StatInfo hash of file status information for the current directory.
*string path()
Returns the path of the Dir object or NOTHING if no path is set.
nothing chmod(softint mode)
Changes the mode of the directory.
nothing chgrp(string groupname)
Change the group membership of the directory.
list< auto > listDirs(bool full=False)
Retrieves all subdirectory entries in this directory, except "." and ".." directories; if any errors ...
nothing mkdir(string subdir, softint mode=0777)
Creates a direct subdirectory in the Dir object's current path.
copy()
Creates a new directory object with the same character encoding specification and the same path as th...
The File class allows Qore programs to read, write, and create files.
Definition: QC_File.dox.h:66
const False
logical False
Definition: qc_qore.dox.h:96
date date()
This function just returns 1970-01-01Z.
const O_RDONLY
Open the file read-only.
Definition: QC_File.dox.h:813
nothing regex()
This function variant does nothing at all; it is only included for backwards-compatibility with qore ...
Qore namespace.
Definition: QC_AbstractSmartLock.dox.h:2
file status information hash as returned by Dir::list(), Dir::listFiles(), and Dir::listDirs() if the...
Definition: QC_Dir.dox.h:7
int gid
group ID of the owner
Definition: QC_Dir.dox.h:19
int blocks
blocks allocated for the file; may be zero if the platform's internal stat() (2) function does not pr...
Definition: QC_Dir.dox.h:13
string type
a string giving the file type; one of: - "BLOCK-DEVICE" - "DIRECTORY" - "CHARACTER-DEVICE" - "...
Definition: QC_Dir.dox.h:39
date mtime
last modified time of the file
Definition: QC_Dir.dox.h:27
int rdev
device type number
Definition: QC_Dir.dox.h:35
int size
file size in bytes
Definition: QC_Dir.dox.h:37
string perm
a string giving UNIX-style permissions for the file (ex: "-rwxr-xr-x")
Definition: QC_Dir.dox.h:33
int inode
inode of the file
Definition: QC_Dir.dox.h:21
int blksize
block size; may be zero if the platform's internal stat() (2) function does not provide this info
Definition: QC_Dir.dox.h:11
int nlink
number of hard links to this file
Definition: QC_Dir.dox.h:31
string name
a string giving the file or directory name
Definition: QC_Dir.dox.h:29
int mode
inode protection mode
Definition: QC_Dir.dox.h:25
date ctime
last change time of the file's inode
Definition: QC_Dir.dox.h:15
date atime
last access time of the file
Definition: QC_Dir.dox.h:9
*string link
symbolic link target (if present)
Definition: QC_Dir.dox.h:23
int dev
device inode number the file is on
Definition: QC_Dir.dox.h:17
int uid
user ID of the owner
Definition: QC_Dir.dox.h:41