# Check result of FileUtils command

**URL:** <https://forum.crystal-lang.org/t/check-result-of-fileutils-command/4250>\
**Category:** Help & Support\
**Created:** [January 11, 2022, 11:09pm UTC](https://forum.crystal-lang.org/t/check-result-of-fileutils-command/4250 "2022-01-11T23:09:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fulgurance](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/fulgurance/32/1463_2.png) [@Fulgurance](https://forum.crystal-lang.org/u/Fulgurance)\
**Post date:** [January 11, 2022, 11:09pm UTC](https://forum.crystal-lang.org/t/check-result-of-fileutils-command/4250/1 "2022-01-11T23:09:08Z")

</div>

Hello, I have a question. Inside a function I would like to check the result of some FileUtils command, like FileUtils.rm\_r, FileUtils.mv or as well some no FileUtils command like Dir.mkdir (for example impossible to make due to a rights problem)

---

<div class="post-metadata">

**Author:** ![beta-ziliani](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/beta-ziliani/32/1821_2.png) [@beta-ziliani](https://forum.crystal-lang.org/u/beta-ziliani)\
**Post date:** [January 13, 2022, 6:08pm UTC](https://forum.crystal-lang.org/t/check-result-of-fileutils-command/4250/2 "2022-01-13T18:08:21Z")

</div>

Sorry that the documentation is not clear on this point. File operations raise subclasses of `File::Error`, more specifically: [crystal/error.cr at c783cc44e135bfbf8bb207baf8908d075720bade · crystal-lang/crystal · GitHub](https://github.com/crystal-lang/crystal/blob/c783cc44e135bfbf8bb207baf8908d075720bade/src/file/error.cr#L8). If it doesn’t raise, then the operation succeeded. Hope this helps.
