Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum searching for files that have apostrophes
    • Sign In

    • State Verified Answer
    • Replies 12 replies
    • Answers 1 answer
    • Subscribers 66 subscribers
    • Views 1204 views
    • Users 0 members are here

    searching for files that have apostrophes

    Stephen Herrick
    Offline Stephen Herrick over 2 years ago

    All,

    i am exporting documents using 

     Get-PWDocumentsBySearch -FolderPath $RootProject.FullPath -FileName $file -GetVersionsToo | Export-PWDocuments -OutputFolder $CopyTo -Verbose

    i am reading a csv file to get the list of files i need to search and export, the file names are very long and some have special characters as shown below

    2021-07-15_Sub 1497.A_Flatiron-Lane JV, May Creek Bridge Southbound Wave Equation Analysis, PP30'x0.625', APE D50-42 and .pdf

    When i search for the document using ProjectWise search, it finds the document

    however when i run the cmdlet, it errors, stating file not found

    when i expand the variable using the write-host is shows the following

    @{Files_to_Export=2021-07-15_Sub 1497.A_Flatiron-Lane JV, May Creek Bridge Southbound Wave Equation Analysis, PP30'x0.625', APE D50-42 and .pdf}

    but of course when i expand the variable is shows thename im looking for

    PS C:\WINDOWS\system32> $File

    Files_to_Export
    ---------------
    2021-07-15_Sub 1497.A_Flatiron-Lane JV, May Creek Bridge Southbound Wave Equation Analysis, PP30'x0.625', APE D50-42 and .pdf

    what am i doing wrong,

    TIA

    Stephen

    • Sign in to reply
    • Cancel

    Top Replies

    • Brian Flaherty
      Offline Brian Flaherty Thu, Jul 29 2021 11:58 AM in reply to Stephen Herrick +1 verified
      You can try using the Export-PWDocuments with the -UseDMSFolders switch parameter.
    • Stephen Herrick
      0 Offline Stephen Herrick Thu, Jul 29 2021 10:17 AM

      also to note, if i set the variable like this $testme = "2021-07-15_Sub 1497.A_Flatiron-Lane JV, May Creek Bridge Southbound Wave Equation Analysis, PP30'x0.625', APE D50-42 and .pdf"

      the search finds the file, 

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Matt Kovach
      0 Offline Matt Kovach Thu, Jul 29 2021 10:31 AM in reply to Stephen Herrick

      Hello Stephen,

      I'm assuming that the Column Header (for the File Names) in your CSV File is "Files_to_Export"? Also, have you considered using an Excel Worksheet instead (via Import-Excel) cmdlet? I see that your File Names contain commas. I'm wondering if the Import-Csv cmdlet is seeing those which then "breaks up" the File Name.

      ProjectWise Explorer CONNECT Edition, Version 10.00.03.453

      ProjectWise Drive, Version 2022.1.328

      OpenRoads Designer CONNECT Edition, Version 10.09.00.91

      OpenRoads Designer CE 202 Release 2, Version 10.10.21.4

      Power GEOPAK V8i (SELECTseries 10), Version 08.11.09.918

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Stephen Herrick
      0 Offline Stephen Herrick Thu, Jul 29 2021 10:39 AM in reply to Matt Kovach

      Matt,

      yes the header is "Files_to_Export,

      Just a habit of using import-csv

      i have the same hunch that the apostrophes are causing the issue, just dont know how in PS to fix it.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Matt Kovach
      0 Offline Matt Kovach Thu, Jul 29 2021 10:39 AM in reply to Stephen Herrick

      Sorry. I missed the statement where the $File variable value shows the correct File Name. I checked to see if Windows would hate this File Name (it was OK with it). The one other thing I noticed in the Help for this cmdlet is that it preserves the Folder Structure. Can you share the Source Path and Copy To Paths? I am now wondering if they are too long for Windows to handle.

      Per the Help:

      "Folder structure is preserved (even long paths so make sure you have a Windows File Explorer replacement that can navigate long paths)."

      ProjectWise Explorer CONNECT Edition, Version 10.00.03.453

      ProjectWise Drive, Version 2022.1.328

      OpenRoads Designer CONNECT Edition, Version 10.09.00.91

      OpenRoads Designer CE 202 Release 2, Version 10.10.21.4

      Power GEOPAK V8i (SELECTseries 10), Version 08.11.09.918

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Stephen Herrick
      0 Offline Stephen Herrick Thu, Jul 29 2021 11:06 AM in reply to Matt Kovach

      thats a good thought, but why when i put the file name does it export fine,

      Also, what is the cmdlet to simply copy the file out, without doing the folder structure

      • 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