Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request: add a count property for each folder of the tree #34

Closed
ipico opened this issue Sep 3, 2024 · 0 comments · Fixed by #35
Closed

request: add a count property for each folder of the tree #34

ipico opened this issue Sep 3, 2024 · 0 comments · Fixed by #35
Assignees
Labels
enhancement New feature or request

Comments

@ipico
Copy link

ipico commented Sep 3, 2024

ps has a measure-object.count method which is what my current script uses as it iterates through the tree.

ForEach ($currentFolder in $FoldersArray) {
  #display the current path being evaluated
  $currentFolder.FullName
  
  #retrieve the contents of the current folder and store it in "currentFolderArr"
  $currentFolderArr = @(
    Get-ChildItem $currentFolder.FullName -Recurse -Force -ErrorAction SilentlyContinue -Exclude 'dfsrprivate' |
      Select-Object FullName, Length, PSIsContainer #this is a throwaway, just to populate the array for a count
  )

  #count the total number of files/folders in this current folder
  $ItemCount = ($currentFolderArr | Measure-Object).Count

Could the count be added as a PSTree property?

@santisq santisq linked a pull request Sep 3, 2024 that will close this issue
@santisq santisq self-assigned this Sep 3, 2024
@santisq santisq added the enhancement New feature or request label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants