txt: ## basename.md
  basename
  
  Combined from primary sources listed below.
  
  # [In IO::Spec::Unix](#___top "go to top of document")[§](#(IO::Spec::Unix)_method_basename "direct link")
  
  See primary documentation
  [in context](/type/IO/Spec/Unix#method_basename)
  for **method basename**.
  
  ```raku
  method basename(Str:D $path --> Str:D)
  ```
  
  Takes a path as a string and returns a possibly-empty portion after the last slash:
  
  ```raku
  IO::Spec::Unix.basename("foo/bar/") .raku.say; # OUTPUT: «""␤»
  IO::Spec::Unix.basename("foo/bar/.").raku.say; # OUTPUT: «"."␤»
  IO::Spec::Unix.basename("foo/bar")  .raku.say; # OUTPUT: «"bar"␤»
  ```
  
  # [In IO::Path](#___top "go to top of document")[§](#(IO::Path)_method_basename "direct link")
  
  See primary documentation
  [in context](/type/IO/Path#method_basename)
  for **method basename**.
  
  ```raku
  method basename(IO::Path:D:)
  ```
  
  Returns the basename part of the path object, which is the name of the filesystem object itself that is referenced by the path.
  
  ```raku
  "docs/README.pod".IO.basename.say; # OUTPUT: «README.pod␤»
  "/tmp/".IO.basename.say;           # OUTPUT: «tmp␤»
  ```
  
  Note that in [`IO::Spec::Win32`](/type/IO/Spec/Win32) semantics, the `basename` of a Windows share is `\`, not the name of the share itself:
  
  ```raku
  IO::Path::Win32.new('//server/share').basename.say; # OUTPUT: «\␤»
  ```
  
  # [In IO::Spec::Win32](#___top "go to top of document")[§](#(IO::Spec::Win32)_method_basename "direct link")
  
  See primary documentation
  [in context](/type/IO/Spec/Win32#method_basename)
  for **method basename**.
  
  ```raku
  method basename(Str:D $path --> Str:D)
  ```
  
  Takes a path as a string and returns a possibly-empty portion after the last slash or backslash:
  
  ```raku
  IO::Spec::Win32.basename("foo/bar/") .raku.say; # OUTPUT: «""␤»
  IO::Spec::Win32.basename("foo/bar\\").raku.say; # OUTPUT: «""␤»
  IO::Spec::Win32.basename("foo/bar/.").raku.say; # OUTPUT: «"."␤»
  IO::Spec::Win32.basename("foo/bar")  .raku.say; # OUTPUT: «"bar"␤»
  ```
  