[fs.op.remove.all]

# 31 Input/output library [[input.output]](./#input.output)

## 31.12 File systems [[filesystems]](filesystems#fs.op.remove.all)

### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.remove.all)

#### 31.12.13.32 Remove all [fs.op.remove.all]

[ð](#lib:remove_all)

`uintmax_t filesystem::remove_all(const path& p);
uintmax_t filesystem::remove_all(const path& p, error_code& ec);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18474)

*Effects*: Recursively deletes the contents of p if it exists,
 then deletes file p itself, as if by POSIX remove[.](#1.sentence-1)

[*Note [1](#note-1)*:

A symbolic link is itself removed, rather than the file it
 resolves to[.](#1.sentence-2)

â *end note*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18483)

*Postconditions*: exists(symlink_status(p)) is false[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18487)

*Returns*: The number of files removed[.](#3.sentence-1)

The signature with argument ec returns static_cast< uintmax_t>(-1) if an error
 occurs[.](#3.sentence-2)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L18493)

*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)
