zdir(3) ======= NAME ---- zdir - work with file-system directories SYNOPSIS -------- ---- // Create a new directory item that loads in the full tree of the // specified path, optionally located under some parent path. CZMQ_EXPORT zdir_t * zdir_new (const char *path, const char *parent); // Destroy a directory tree and all children it contains. CZMQ_EXPORT void zdir_destroy (zdir_t **self_p); // Return directory path CZMQ_EXPORT char * zdir_path (zdir_t *self); // Return last modification time for directory. CZMQ_EXPORT time_t zdir_modified (zdir_t *self); // Return total hierarchy size, in bytes of data contained in all files // in the directory tree. CZMQ_EXPORT off_t zdir_cursize (zdir_t *self); // Return directory count CZMQ_EXPORT size_t zdir_count (zdir_t *self); // Returns a sorted array of zfile objects; returns a single block of memory, // that you destroy by calling free(). Each entry in the array is a pointer // to a zfile_t item already allocated in the zdir tree. The array ends with // a null pointer. Do not destroy the original zdir tree until you are done // with this array. CZMQ_EXPORT zfile_t ** zdir_flatten (zdir_t *self); // Print contents of directory to stderr CZMQ_EXPORT void zdir_dump (zdir_t *self, int indent); // Remove directory, optionally including all files that it contains, at // all levels. If force is false, will only remove the directory if empty. // If force is true, will remove all files and all subdirectories. CZMQ_EXPORT void zdir_remove (zdir_t *self, bool force); // Self test of this class CZMQ_EXPORT int zdir_test (bool verbose); ---- DESCRIPTION ----------- The zdir class gives access to the file system index. It will load a directory tree (a directory plus all child directories) into a zdir structure and then let you navigate that structure. It exists mainly to wrap non-portable OS functions to do this. EXAMPLE ------- .From zdir_test method ---- zdir_t *older = zdir_new (".", NULL); assert (older); if (verbose) { printf ("\n"); zdir_dump (older, 0); } zdir_destroy (&older); zdir_t *nosuch = zdir_new ("does-not-exist", NULL); assert (nosuch == NULL); ---- SEE ALSO -------- linkczmq:czmq[7]