Qore Programming Language Reference Manual  0.8.13.5
 All Classes Namespaces Functions Variables Groups Pages
QC_Dir.dox.h
1 namespace Qore {
4 
6 struct DirStatInfo {
10  int blksize;
12  int blocks;
16  int dev;
18  int gid;
20  int inode;
22  *string link;
24  int mode;
28  string name;
30  int nlink;
32  string perm;
34  int rdev;
36  int size;
38  string type;
40  int uid;
41 };
42 };
44 namespace Qore {
46 
55 class Dir {
56 
57 public:
59 
76 bool chdir(string path);
77 
78 public:
80 
101 nothing chgrp(int gid);
102 
103 public:
105 
127 nothing chgrp(string groupname);
128 
129 public:
131 
149 nothing chmod(softint mode);
150 
151 public:
153 
174 nothing chown(int uid);
175 
176 public:
178 
200 nothing chown(string username);
201 
202 public:
204 
213  constructor(*string encoding);
214 
215 public:
217 
222  copy();
223 
224 public:
226 
248 int create(softint mode = 0777);
249 
250 public:
252 
260 bool exists();
261 
262 public:
264 
284 hash<StatInfo> hstat();
285 
286 public:
288 
310 list list(bool full = False);
311 
312 public:
314 
342 list list(string regex, softint regex_options = 0, softbool full = False);
343 
344 public:
346 
370 list listDirs(bool full = False);
371 
372 public:
374 
402 list listDirs(string regex, softint regex_options = 0, softbool full = False);
403 
404 public:
406 
430 list listFiles(bool full = False);
431 
432 public:
434 
462 list listFiles(string regex, softint regex_options = 0, softbool full = False);
463 
464 public:
466 
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 
561 bool removeFile(string file);
562 
563 public:
565 
585 nothing rmdir(string subdir);
586 
587 public:
589 
609 list stat();
610 
611 public:
613 
634 hash<FilesystemInfo> statvfs();
635 };
636 };
list listDirs(bool full=False)
Retrieves all subdirectory entries in this directory, except &quot;.&quot; and &quot;..&quot; directories; if any errors ...
date date(date dt)
Returns the date passed.
nothing rmdir(string subdir)
Removes a direct subdirectory from the Dir object&#39;s current path.
int mode
inode protection mode
Definition: QC_Dir.dox.h:24
date ctime
last change time of the file&#39;s inode
Definition: QC_Dir.dox.h:14
This class implements directory handling, file listing, creating/removing subdirectories, etc.
Definition: QC_Dir.dox.h:55
int gid
group ID of the owner
Definition: QC_Dir.dox.h:18
*string link
symbolic link target (if present)
Definition: QC_Dir.dox.h:22
constructor(*string encoding)
Creates the Directory object.
int nlink
number of hard links to this file
Definition: QC_Dir.dox.h:30
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:34
*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: &quot;-rwxr-xr-x&quot;)
Definition: QC_Dir.dox.h:32
date mtime
last modified time of the file
Definition: QC_Dir.dox.h:26
date atime
last access time of the file
Definition: QC_Dir.dox.h:8
bool removeFile(string file)
Remove the file with the given name in the Dir object&#39;s directory.
const False
logical False
Definition: qc_qore.dox.h:92
int dev
device inode number the file is on
Definition: QC_Dir.dox.h:16
nothing mkdir(string subdir, softint mode=0777)
Creates a direct subdirectory in the Dir object&#39;s current path.
int uid
user ID of the owner
Definition: QC_Dir.dox.h:40
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:20
file status information hash as returned by Dir::list(), Dir::listFiles(), and Dir::listDirs() if the...
Definition: QC_Dir.dox.h:6
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&#39;s internal stat() (2) function does not pr...
Definition: QC_Dir.dox.h:12
hash< StatInfo > hstat()
Returns a StatInfo hash of file status information for the current directory.
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.
list listFiles(bool full=False)
Retrieves all files in this directory; if any errors occur an exception is thrown.
int size
file size in bytes
Definition: QC_Dir.dox.h:36
int blksize
block size; may be zero if the platform&#39;s internal stat() (2) function does not provide this info ...
Definition: QC_Dir.dox.h:10
list list(bool full=False)
Get all entries in this directory, except &quot;.&quot; and &quot;..&quot; directories; if any errors occur an exception ...
const O_RDONLY
Open the file read-only.
Definition: QC_File.dox.h:760
The File class allows Qore programs to read, write, and create files.
Definition: QC_File.dox.h:50
string type
a string giving the file type; one of: - &quot;BLOCK-DEVICE&quot; - &quot;DIRECTORY&quot; - &quot;CHARACTER-DEVICE&quot; - &quot;...
Definition: QC_Dir.dox.h:38
nothing chgrp(int gid)
Change the group membership of the directory from the group id.
list stat()
Returns a list of file status information for the current directory.
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:28
Dir openDir(string subdir, *string encoding)
Get a Dir object as an subdir entry of the current directory.