Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Import-PWDocuments issues with drive as InputFolder and long path
    • Sign In

    • State Suggested Answer
    • Replies 10 replies
    • Answers 1 answer
    • Subscribers 67 subscribers
    • Views 1601 views
    • Users 0 members are here
    • Import-PWDocuments
    • powershell
    • pwps_dab

    Import-PWDocuments issues with drive as InputFolder and long path

    Mathieu Bengle
    Offline Mathieu Bengle over 1 year ago

    Hi,

    I'm running into two issues with cmlet Import-PWDocuments.

    1- When $Inputfolder path is located on my c drive, I can import every file in sub-folders, but when it is located on a drive only folder structure is imported with the fil in the parent folder.

     -  from my C drive --> $InputFolder = '\\localhost\c$\Users\MYUSERNAME\Desktop\temp\1.0 Intrants'

    VERBOSE: Found 9 files.
    VERBOSE: End getting folders.
    VERBOSE: Found 4 folders

    - from drive --> $InputFolder = '\\localhost\c$\Users\MYUSERNAME\MYCOMPANY O365\GROUPNAME\1.0 Intrants'

    VERBOSE: Found 1 files.
    VERBOSE: End getting folders.
    VERBOSE: Found 4 folders

    2- I get error code 58183 for a folder because string value is too long. Unfortunatly I cannot change folder and file names. Windows long path is enabled as well.

    VERBOSE: Looking for ProjectWise folder '_Sandbox\Script testing\Powershell\SP to PW\Incoming\20210226_6_Étude d'opportunité_Corridor élargi «A-15-prolongement de l'
    A-13»'
    WARNING: Error creating folder '_Sandbox\Script testing\Powershell\SP to PW\Incoming\20210226_6_Étude d'opportunité_Corridor élargi «A-15-prolongement de l'A-13»' Er
    ror 58183

    How can I fix this?

    Config:

    Microsoft Windows NT 10.0.19042.0
    Windows long paths enabled
    PSVersion: 5.1.19041.1237
    pwps_dab: 1.30.10.0
    ProjectWise 03.434

    $ProjectWiseFolder = '_Sandbox\Script testing\Powershell\SP to PW\Incoming'
    $InputFolder = '\\localhost\c$\Users\MYUSERNAME\MYCOMPANY O365\GROUPNAME\1.0 Intrants'
    
    New-PWLogin -UseGui -Verbose
    
    Import-PWDocuments -InputFolder $InputFolder -CreateVersions -DefaultStorage Storage -ExcludeSourceDirectoryFromTargetPath -IncludeEmptyFolders -ProjectWiseFolder $ProjectWiseFolder -SuppressOutput -Verbose
    
    Undo-PWLogin -Verbose

    Thanks for your help

    • Sign in to reply
    • Cancel

    Top Replies

    • Kevin van Haaren
      Offline Kevin van Haaren Fri, Dec 3 2021 5:12 PM in reply to Dan Williams +2
      There is another trick you can use here as well. This works if the really long path is on a mapped network drive or on your c: drive too. The command line program subst allows you to substitute a drive…
    • Dan Williams
      Offline Dan Williams Fri, Dec 3 2021 6:44 PM in reply to Kevin van Haaren +1
      Thanks Kevin van Haaren ! I haven't used that command in years, but I do remember using it in the past. FWIW, I got curious if there was a way to do this in PowerShell, and there is. If you are interested…
    • Kevin van Haaren
      Offline Kevin van Haaren Sun, Dec 5 2021 7:20 PM in reply to Dan Williams +1
      nice. i experimented a bit, drives created with subst will show up with Get-PSDrive (immediately, don't need to relaunch ps). Using new-psdrive to create a mapping to the local system won't show up in…

    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