Documentation for method
unlink assembled from the following types:
method unlink(IO::Path: --> True)sub unlink(* --> List)
Delete all specified ordinary files, links, or symbolic links for which there are privileges to do so. See rmdir to delete directories.
The subroutine form returns the names of all the files in the list, excluding those for which the filesystem raised some error; since trying to delete a file that does not exist does not raise any error at that level, this list will include the names of the files in the list that do not exist.
'foo.txt'.IO.open(:w).close;'bar'.IO.mkdir;say unlink <foo.txt bar not-there.txt>; # OUTPUT: «[foo.txt not-there.txt]␤»# `bar` is not in output because it failed to delete (it's a directory)# `not-there.txt` is present. It never existed, so that's deemed a success.# Method form `fail`s:say .exception.message without 'bar'.IO.unlink;# OUTPUT: «Failed to remove the file […] illegal operation on a directory␤»