Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Get-PWFolder and Get-PWRichProjects
    • Sign In

    • State Verified Answer
    • Replies 10 replies
    • Subscribers 67 subscribers
    • Views 5560 views
    • Users 0 members are here
    • pwps_dab

    Get-PWFolder and Get-PWRichProjects

    Patrick Tran
    Offline Patrick Tran over 5 years ago

    Is there any cmdlet that will return only the contents of a specific folder (and not the tree below it)? 

    Our directory structure is set up in a way that I can easily pipeline and filter for the specific folders I want, but the two aforementioned cmdlets seem to parse through every folder before anything is returned, which takes a very long time.

    Documents\Clients\Projects\Project Folders and Files\

    If the above is my folder structure, what's the best way to just return a collection of Clients?

    • Sign in to reply
    • Cancel

    Top Replies

    • Brian Flaherty
      Offline Brian Flaherty Thu, Mar 29 2018 7:53 AM in reply to Kevin van Haaren +2 verified
      I have had a couple of requests for this functionality. I have create cmdlet 'Get-PWFoldersImmediateChildren' to return only the immediate child folders of a specified folder. This should be available…
    • Kevin van Haaren
      0 Offline Kevin van Haaren Tue, Mar 27 2018 8:38 PM

      Should be an option -justone or -justthisone that turns off recursion. Sorry I can’t remember the exact option, I’m on my iPad.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Patrick Tran
      0 Offline Patrick Tran Tue, Mar 27 2018 9:02 PM in reply to Kevin van Haaren

      -justone returns the parent folder.

      Get-PWRichProjects -folderpath 'Documents' -justone just returns Documents

      Get-PWRichProjects -folderpath 'Documents' | where { $_.property -eq Client } gives me my desired results, but its still parsing through the entire tree below Documents\ before it returns.

      (Folder/property names and values aren't exact. Just providing descriptions where apt.)

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Tue, Mar 27 2018 9:32 PM in reply to Patrick Tran

      I don't think this is currently possible. You can build a Saved Search that does what you want, but there is no Get-PWFoldersBySearch like there is for documents.

      saved search i built to get RichProjects (now called Work Areas) below a folder without recursing into sub-folders:

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Tue, Mar 27 2018 9:43 PM in reply to Kevin van Haaren

      Get-PWRichProjects -FolderPath "Users\" | where FullPath -notlike "Users\*\*"

      works for me, but like you say it is really slow.

      In addition to Get-PWFoldersBySearch it would be nice to have a command just to return immediate children for all the get-pwfolders and get-pwdocuments commands.

      Perhaps -JustChildren or -JustImmediateChildren would work? I wonder how get-childitem handles this scenario.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Patrick Tran
      0 Offline Patrick Tran Wed, Mar 28 2018 4:36 PM in reply to Kevin van Haaren

      I've decided to keep the code as it is and make any further extensions revolve around a .csv output. The line above can just be run routinely to keep the .csv, and the .csv can be imported for any quick property lookups. 

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    >

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies