PSFolderSize icon indicating copy to clipboard operation
PSFolderSize copied to clipboard

Error when `Get-FolderSize` is executed in `/` on linux and Mac

Open aristosvo opened this issue 4 years ago • 2 comments

On linux and Mac I've an error showing up when the command is triggered in /.

Setup:

PS /> Get-Host | Select-Object Version

Version
-------
7.1.4
PS /> (Get-Location)

Path
----
/

Command and Error:

PS /> (Get-FolderSize -FolderName 'etc') 
Split-Path: /root/.local/share/powershell/Modules/PSFolderSize/1.7.1/Functions/Private/Get-FolderList.ps1:72
Line |
  72 |          $splitPath = Split-Path -Path $BasePath
     |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot process argument because the value of argument "path"
     | is not valid. Change the value of the "path" argument and run
     | the operation again.

Workaround:

PS /> (Get-FolderSize -FolderName 'etc' -Path '.')

FolderName                     SizeMB       SizeGB       FullPath
----------                     ------       ------       --------
etc                            3.37         0            /etc

aristosvo avatar Aug 24 '21 16:08 aristosvo

Oh, I like this issue and fix. I think this would be great for simplifying how to search folder sizes in Linux. though there are a thousand tools for it, they are not as universal in many cases.

cengbrecht avatar Jan 16 '23 19:01 cengbrecht

Taking a look at this next! Thanks for the information.

gngrninja avatar Jan 31 '23 17:01 gngrninja