txt: ## unlink.md
  unlink
  
  Combined from primary sources listed below.
  
  # [In IO::Path](#___top "go to top of document")[§](#(IO::Path)_routine_unlink "direct link")
  
  See primary documentation
  [in context](/type/IO/Path#routine_unlink)
  for **routine unlink**.
  
  ```raku
  method unlink(IO::Path:D: --> True)
  sub    unlink(*@filenames --> List:D)
  ```
  
  Delete all specified ordinary files, links, or symbolic links for which there are privileges to do so. See [rmdir](/routine/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.
  
  The method form returns `True` on success, or [fails](/routine/fail) with [`X::IO::Unlink`](/type/X/IO/Unlink) if the operation could not be completed. If the file to be deleted does not exist, the routine treats it as success.
  
  ```raku
  '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␤»
  
  ```
  