Qore Programming Language Reference Manual  0.9.4
QC_Dir.dox.h
1 
3 namespace Qore {
5 
7 struct DirStatInfo {
11  int blksize;
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 
46 namespace Qore {
48 
57 class Dir {
58 
59 public:
61 
78 bool chdir(string path);
79 
80 public:
82 
102 nothing chgrp(int gid);
103 
104 public:
106 
127 nothing chgrp(string groupname);
128 
129 public:
131 
148 nothing chmod(softint mode);
149 
150 public:
152 
172 nothing chown(int uid);
173 
174 public:
176 
197 nothing chown(string username);
198 
199 public:
201 
210  constructor(*string encoding);
211 
212 public:
214 
219  copy();
220 
221 public:
223 
244 int create(softint mode = 0777);
245 
246 public:
248 
256 bool exists();
257 
258 public:
260 
279 hash<StatInfo> hstat();
280 
281 public:
283 
306 list<auto> list(bool full = False);
307 
308 public:
310 
339 list<auto> list(string regex, softint regex_options = 0, softbool full = False);
340 
341 public:
343 
368 list<auto> listDirs(bool full = False);
369 
370 public:
372 
401 list<auto> listDirs(string regex, softint regex_options = 0, softbool full = False);
402 
403 public:
405 
430 list<auto> listFiles(bool full = False);
431 
432 public:
434 
463 list<auto> listFiles(string regex, softint regex_options = 0, softbool full = False);
464 
465 public:
467 
485 nothing mkdir(string subdir, softint mode = 0777);
486 
487 public:
489 
501 Dir openDir(string subdir, *string encoding);
502 
503 public:
505 
522 File openFile(string filename, int flags = O_RDONLY, int mode = 0666, *string encoding);
523 
524 public:
526 
535 *string path();
536 
537 public:
539 
560 bool removeFile(string file);
561 
562 public:
564 
583 nothing rmdir(string subdir);
584 
585 public:
587 
606 list<auto> stat();
607 
608 public:
610 
630 hash<FilesystemInfo> statvfs();
631 };
632 }
date date(date dt)
Returns the date passed.
nothing rmdir(string subdir)
Removes a direct subdirectory from the Dir object's current path.
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
list< auto > list(bool full=False)
Get all entries in this directory, except "." and ".." directories; if any errors occur an exception ...
This class implements directory handling, file listing, creating/removing subdirectories,...
Definition: QC_Dir.dox.h:57
int gid
group ID of the owner
Definition: QC_Dir.dox.h:19
*string link
symbolic link target (if present)
Definition: QC_Dir.dox.h:23
list< auto > listFiles(bool full=False)
Retrieves all files in this directory; if any errors occur an exception is thrown.
list< auto > stat()
Returns a list of file status information for the current directory.
constructor(*string encoding)
Creates the Directory object.
int nlink
number of hard links to this file
Definition: QC_Dir.dox.h:31
int create(softint mode=0777)
Creates the directory tree the Dir object points to, if it does not exist.
int rdev
device type number
Definition: QC_Dir.dox.h:35
*string path()
Returns the path of the Dir object or NOTHING if no path is set.
string perm
a string giving UNIX-style permissions for the file (ex: "-rwxr-xr-x")
Definition: QC_Dir.dox.h:33
date mtime
last modified time of the file
Definition: QC_Dir.dox.h:27
date atime
last access time of the file
Definition: QC_Dir.dox.h:9
bool removeFile(string file)
Remove the file with the given name in the Dir object's directory.
const False
logical False
Definition: qc_qore.dox.h:96
int dev
device inode number the file is on
Definition: QC_Dir.dox.h:17
nothing mkdir(string subdir, softint mode=0777)
Creates a direct subdirectory in the Dir object's current path.
int uid
user ID of the owner
Definition: QC_Dir.dox.h:41
bool regex(string str, string regex, int options=0)
Returns True if the regular expression matches the string passed, otherwise returns False.
int inode
inode of the file
Definition: QC_Dir.dox.h:21
file status information hash as returned by Dir::list(), Dir::listFiles(), and Dir::listDirs() if the...
Definition: QC_Dir.dox.h:7
bool exists()
Returns True if the path in the Dir object points to a directory that already exists and is openable ...
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.
nothing chmod(softint mode)
Changes the mode of the directory.
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
hash< StatInfo > hstat()
Returns a StatInfo hash of file status information for the current directory.
list< auto > listDirs(bool full=False)
Retrieves all subdirectory entries in this directory, except "." and ".." directories; if any errors ...
copy()
Creates a new directory object with the same character encoding specification and the same path as th...
nothing chown(int uid)
Change the ownership of the directory from the userid.
int size
file size in bytes
Definition: QC_Dir.dox.h:37
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
const O_RDONLY
Open the file read-only.
Definition: QC_File.dox.h:781
The File class allows Qore programs to read, write, and create files.
Definition: QC_File.dox.h:51
string type
a string giving the file type; one of: - "BLOCK-DEVICE" - "DIRECTORY" - "CHARACTER-DEVICE" - "...
Definition: QC_Dir.dox.h:39
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3
nothing chgrp(int gid)
Change the group membership of the directory from the group id.
bool chdir(string path)
Changes the current directory of the Dir object to the path given.
hash< FilesystemInfo > statvfs()
Returns a FilesystemInfo hash for the current directory.
string name
a string giving the file or directory name
Definition: QC_Dir.dox.h:29
Dir openDir(string subdir, *string encoding)
Get a Dir object as an subdir entry of the current directory.