function

rmdir . files . sncode

VERSIONlatest Use to remove directories.

RMDIR

NAME

rmdir - Used to remove directories.

SYNOPSIS

rmdir([recursive:true|false,] "directories");

DESCRIPTION

This function is used to remove directories.

If you want to remove the directories and they are not empty, set the "recursive" parameter to true to remove everything.

Removing a non directory produces an error.

Removing a non existing directory is silently ignore.

Removing a non empty directory produces an error unless recursive is true.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

res={_{ rmdir("/xyxyx"); }}. return Can't remove directory
res={_{ rmdir("/tests/time"); }}. return Not a directory
res={_{ rmdir("/tests"); }}. return Directory not empty

res={_{
        %include "/includes/extenso.sn";
        rmdir("/tmp/abc");
        mkdir(owner:"rw",group:"rwx",other:"x","/tmp/abc");
        -e "/tmp/abc";
        a=stat("/tmp/abc");
        printf(" %x",a.fileperms);
        }}.), qq(res=true 651.));

res={_{
        %include "/includes/extenso.sn";
        rmdir("/tmp/abc");
        mkdir(permissions:UREAD|UWRITE|UEXECUTE|GREAD|GWRITE|GEXECUTE|WWRITE|WREAD|WEXECUTE,"/tmp/abc");
        -e "/tmp/abc";
        a=stat("/tmp/abc");
        printf(" %x",a.fileperms);
        }}.), qq(res=true 755.));


res={_{
        %include "/includes/extenso.sn";
        rmdir("/tmp/abc");
        mkdir(permissions:UWRITE|UREAD,group:"rwx","/tmp/abc");
        -e "/tmp/abc";
        a=stat("/tmp/abc");
        printf(" %x",a.fileperms);
        " "; a.fileperms & WWRITE != 0;
        " "; a.fileperms & UWRITE != 0;
        " "; a.fileperms & GWRITE != 0;
        " "; a.fileperms & GREAD != 0;
        rmdir("/tmp/abc");
        " "; -e "/tmp/abc";
        }}. return res=true 650 false true false true false.


res={_{ mkdir(date:"...",atdate:"...","/tmp/xxx"); }}. return Parameter date is not valid
res={_{ mkdir(owner:"abc","/tmp/abc"); }}. return Invalid perms for owner.
res={_{ mkdir(group:"abc","/tmp/abc"); }}. return Invalid perms for group
res={_{ mkdir(other:"abc","/tmp/abc"); }}. return Invalid perms for other
res={_{ %include "/includes/extenso.sn";
        rmdir("/tmp/abc");
        mkdir("/tmp/abc");
        -e "/tmp/abc"; a=stat("/tmp/abc");
        printf("%x",a.fileperms);
        "wwrite="; a.fileperms & WWRITE != 0;
        "uwrite="; a.fileperms & UWRITE != 0;
        rmdir("/tmp/abc");
        -e "/tmp/abc";
        rmdir("/tmp/abc");
        rmdir("/tmp/abc");
        rmdir("/tmp/abc");
        rmdir("/tmp/abc");
        mkdir("/tmp/abc/def/ghi");
        -e "/tmp/abc/def/ghi";
        rmdir("/tmp/abc");
        -e "/tmp/abc";
        rmdir(recursive:true,"/tmp/abc");
        -e "/tmp/abc";
        }}. return res=true755wwrite=falseuwrite=truefalsetruetruefalse.

res={_{
        %include "/includes/extenso.sn";
        mkdir(permissions:UWRITE|UREAD,"/tmp/abc");
        -e "/tmp/abc"; a=stat("/tmp/abc");
        printf(" %x",a.fileperms);
        " "; a.fileperms & WWRITE != 0;
        " "; a.fileperms & UWRITE != 0;
        rmdir("/tmp/abc");
        " "; -e "/tmp/abc";
        }}. return res=true 600 false true false.

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>