Powershell: 5.0
Hi!
How powershell get basename from file with "." in name?
And for a dir ?
Filename: test.txt
dir: /test01.test/
Filename: test
dir: test01
Thanks
That's not what basename in linux does, unless you specify the suffix:
basename /users/js/file.txt
file.txt
basename file.txt .txt
file
However here's a way to do what you want. It prints out the basename property of the fileinfo or dirinfo object. % is short for foreach-object.
get-item file.txt | % basename
file