system_mkdir(3f) - [M_system:FILE_SYSTEM] call mkdir(3c) to create a new directory (LICENSE:PD)
Synopsis
Description
Examples
Author
License
function system_mkdir(dirname,mode) result(ierr)
character(len=*),intent(in) :: dirname integer,intent(in) :: mode integer :: ierr
Predefined variables are typically used to set permission modes. You can bytewise-OR together these variables to create the most common permissions mode:
User: R_USR (read), W_USR (write), X_USR(execute) Group: R_GRP (read), W_GRP (write), X_GRP(execute) Others: R_OTH (read), W_OTH (write), X_OTH(execute)Additionally, some shortcuts are provided (basically a bitwise-OR combination of the above):
Read + Write + Execute: RWX_U (User), RWX_G (Group), RWX_O (Others) DEFFILEMODE: Equivalent of 0666 =rw-rw-rw- ACCESSPERMS: Equivalent of 0777 = rwxrwxrwxTherefore, to give only the user rwx (read+write+execute) rights whereas group members and others may not do anything, you can use any of the following mkdir() calls equivalently:
ierr= mkdir("mydir", IANY([R_USR, W_USR, X_USR])); ierr= mkdir("mydir", RWX_U);In order to give anyone any rights (mode 0777 = rwxrwxrwx), you can use any of the following calls equivalently:
ierr= mkdir("mydir",& & IANY([R_USR,W_USR,X_USR,R_GRP,W_GRP,X_GRP,R_OTH,W_OTH,X_OTH])); ierr= mkdir("mydir",IANY([RWX_U,RWX_G,RWX_O])); ierr= mkdir("mydir",ACCESSPERMS);
Sample program:
program demo_system_mkdir use M_system, only : system_perror use M_system, only : system_mkdir use M_system, only : R_GRP,R_OTH,R_USR,RWX_G,RWX_O use M_system, only : RWX_U,W_GRP,W_OTH,W_USR,X_GRP,X_OTH,X_USR use M_system, only : DEFFILEMODE, ACCESSPERMS implicit none integer :: ierr ierr=system_mkdir(_scratch,IANY([R_USR,W_USR,X_USR])) end program demo_system_mkdir
John S. Urban
Public Domain
Nemo Release 3.1 | system_mkdir (3m_system) | March 07, 2025 |