Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

FileUtils#remove_entry_secure

remove_entry_secure(path, force = false)

Securely removes the entry given by path, which should be the entry for a regular file, a symbolic link, or a directory.

Argument path should be interpretable as a path.

Avoids a local vulnerability that can exist in certain circumstances; see Avoiding the TOCTTOU Vulnerability.

Optional argument force specifies whether to ignore raised exceptions of StandardError and its descendants.

Related: methods for deleting.