*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> mkdirp (3g)              
Title
Content
Arch
Section
 

Contents


mkdirp(3G)							    mkdirp(3G)


NAME    [Toc]    [Back]

     mkdirp, rmdirp - create, remove directories in a path

SYNOPSIS    [Toc]    [Back]

     cc	[flag ...] file	...  -lgen [library ...]

     #include <libgen.h>

     int mkdirp	(const char *path<b>, mode_t mode<b>);

     int rmdirp	(char *d<b>, char *d1<b>);

DESCRIPTION    [Toc]    [Back]

     mkdirp creates all	the missing directories	in the given path with the
     given mode.  [See chmod(2)	for the	values of mode.]

     rmdirp removes directories	in path	d.  This removal starts	at the end of
     the path and moves	back toward the	root as	far as possible.  If an	error
     occurs, the remaining path	is stored in d1.  rmdirp returns a 0 only if
     it	is able	to remove every	directory in the path.

EXAMPLES    [Toc]    [Back]

     /*	create scratch directories */
     if(mkdirp("/tmp/sub1/sub2/sub3", 0755) == -1) {
	  fprintf(stderr, "cannot create directory");
	  exit(1);
     }
     chdir("/tmp/sub1/sub2/sub3");
     .
     .
     .
     /*	cleanup	*/
     chdir("/tmp");
     rmdirp("sub1/sub2/sub3");

DIAGNOSTICS    [Toc]    [Back]

     If	a needed directory cannot be created, mkdirp returns -1	and sets errno
     to	one of the mkdir error numbers.	 If all	the directories	are created,
     or	existed	to begin with, it returns zero.

NOTES    [Toc]    [Back]

     mkdirp uses malloc	to allocate temporary space for	the string.

     rmdirp returns -2 if a ``.'' or ``..''  is	in the path and	-3 if an
     attempt is	made to	remove the current directory.  If an error occurs
     other than	one of the above, -1 is	returned.

SEE ALSO    [Toc]    [Back]

      
      
     mkdir(2), rmdir(2),


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
File::Path IRIX create or remove a series of directories
rmdir FreeBSD remove directories
nisrmdir HP-UX remove NIS+ directories
rmdir OpenBSD remove directories
rmdir HP-UX remove directories
rmdir Linux remove empty directories
rm IRIX remove files or directories
dosrmdir HP-UX remove DOS files or directories
rm HP-UX remove files or directories
rm Linux remove files or directories
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service