<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/products/projectwise/f/projectwise-powershell-extensions-forum/223001/import-pwdocuments-issues-with-drive-as-inputfolder-and-long-path</link><description>Hi, 
 
 I&amp;#39;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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685873?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 21:10:23 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:25410d20-4723-4001-b77e-2e02a5890298</guid><dc:creator>Mathieu Bengle</dc:creator><description>&lt;p&gt;@Kevin van Hareen , when I ran this pointing to&amp;nbsp;my Onedrive path I get all files! So why it doesn&amp;#39;t import all with Import-PWDocuments?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Get-ChildItem -Path $SourceFolderPath -Recurse | Get-FileHash -Algorithm MD5    &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As a workaround, I was thinking&amp;nbsp;to go like this ;&lt;/p&gt;
&lt;p&gt;1- Copy-Item to local drive&lt;br /&gt;2- Rename-Item&lt;br /&gt;3- Import-PWDocuments&lt;br /&gt;4- Delete Copied Items from local drive&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I would like to&amp;nbsp;reduce folder and file names&amp;nbsp;but every test i did with&amp;nbsp; Rename-Item + Substring failed...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685870?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 20:52:16 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:2cf6dc32-5322-451d-a54a-8591e3267d52</guid><dc:creator>Mathieu Bengle</dc:creator><description>&lt;p&gt;Even with this option enabled it only imports file from the parent folder&amp;nbsp;and&amp;nbsp;subfolders but files into subfolders are missing.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685856?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 19:32:28 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:bedeeb3e-1af9-4409-a0c4-1936da1f16c8</guid><dc:creator>Kevin van Haaren</dc:creator><description>&lt;p&gt;Oh I ran into this with ProjectWise Drive and came up with this powershell. Just tested it with my OneDrive and it seems to be working properly.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="powershell"&gt;Get-ChildItem -Path &amp;quot;$($ENV:OneDrive)&amp;quot; -Recurse | Get-FileHash -Algorithm MD5&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This lets me just do the files in the specified path, instead of all of them, and it isn&amp;#39;t permanent.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685853?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 19:14:26 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d56b6343-2715-4cca-83f8-57f8ef5f4724</guid><dc:creator>Adrian Crowfoot</dc:creator><description>&lt;p&gt;Mathieu,&lt;/p&gt;
&lt;p&gt;Remember that OneDrive files are not downloaded until needed. You may need to enable the Always keep on this device option. I suspect there might be a OneDrive PS module as well to automate this piece.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/343592/pastedimage1638818080221v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685607?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 00:20:42 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:28acdec8-a1a2-4752-a309-a8f5564ca535</guid><dc:creator>Kevin van Haaren</dc:creator><description>&lt;p&gt;nice. i experimented a bit, drives created with subst will show up with Get-PSDrive (immediately, don&amp;#39;t need to relaunch ps). Using new-psdrive to create a mapping to the local system won&amp;#39;t show up in subst (with a relaunch of cmd or not). -persist -scope Global will cause the drive to show up in the cmd window using net use, but not subst (you can only use persist with a UNC, no mappings to local drives allowed)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685576?ContentTypeID=1</link><pubDate>Sat, 04 Dec 2021 08:17:26 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:e4642444-c1b3-490d-8f11-2044187eaad2</guid><dc:creator>Dan Williams</dc:creator><description>&lt;p&gt;&lt;a href="/members/e44ded18_2d00_9cd2_2d00_45d4_2d00_a4d1_2d00_8c473f730208"&gt;Mathieu Bengle&lt;/a&gt;,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are asking what the maximum length of a folder name can be in ProjectWise, the answer is 63, and no, there isn&amp;#39;t a way to force a folder to have a longer name.&lt;/p&gt;
&lt;p&gt;However, the folder&amp;#39;s&amp;#39; description can be a maximum of 127 characters.&amp;nbsp; You could come up with a naming scheme to shorten the folder&amp;#39;s name to fix and to be unique, but then use the &amp;quot;real&amp;quot; name as the folder&amp;#39;s description.&amp;nbsp; This way you could then enable the user setting to use descriptions instead of names.&lt;/p&gt;
&lt;p&gt;As for why the files are not imported when you use the Import-PWDocuments Cmdlet with Onedrive mapped to a drive letter?&amp;nbsp; Not sure, but the underlying code for Import-PWDocuments looks like it uses FindFirstFile and the underlying code might not account for network shares as I see some comments in Microsoft&amp;#39;s documentation about some limitations when trying to find files on network shares.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685567?ContentTypeID=1</link><pubDate>Sat, 04 Dec 2021 03:57:39 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:1fadb5a3-e3ba-49dc-8ab1-f885571eab72</guid><dc:creator>Mathieu Bengle</dc:creator><description>&lt;p&gt;It seems that the folder name has too many characters because all other folders with the same path have been created. If I add this folder directly in PW explorer, I also get error for folder name too long. Is there a way to force this?&lt;/p&gt;
&lt;p&gt;Also, do you have any idea why the files are not imported when I use the Import-PWDocuments cmdlet with a drive like Onedrive mapped to X as the input folder :?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685563?ContentTypeID=1</link><pubDate>Fri, 03 Dec 2021 23:44:13 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:b6cee15c-8453-42a6-8e37-1364e89cf4b2</guid><dc:creator>Dan Williams</dc:creator><description>&lt;p&gt;Thanks&amp;nbsp;&lt;a href="/members/d922d832_2d00_03d5_2d00_40d7_2d00_afc4_2d00_bb119ec5aad2"&gt;Kevin van Haaren&lt;/a&gt;!&amp;nbsp; I haven&amp;#39;t used that command in years, but I do remember using it in the past.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;FWIW, I got curious if there was a way to do this in PowerShell, and there is.&amp;nbsp; If you are interested, check out this Cmdlet:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-psdrive?view=powershell-5.1" rel="noopener noreferrer" target="_blank"&gt;New-PSDrive&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t test this out to see if it works with ProjectWise, but I did notice the note in the documentation about the setting the &amp;quot;Scope&amp;quot; parameter value to &amp;quot;Global&amp;quot; to make the drive persist out of the current scope.&amp;nbsp; Not sure if that means it would persist outside of PowerShell or not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685555?ContentTypeID=1</link><pubDate>Fri, 03 Dec 2021 22:12:06 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7526f032-a388-48f1-a84e-c260df453a3b</guid><dc:creator>Kevin van Haaren</dc:creator><description>&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;The command line program subst allows you to substitute a drive letter for any path.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;&amp;gt; subst x: j:\dir1\dir2\dir3\dir4

&amp;gt; subst /?
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

  drive1:        Specifies a virtual drive to which you want to assign a path.
  [drive2:]path  Specifies a physical drive and path you want to assign to
                 a virtual drive.
  /D             Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Running the first command in that, subst x: J:\dir1\dir2\dir3\dir4 allows you to use the shortcut x: for all those paths.&lt;/p&gt;
&lt;p&gt;you can used subst x: /d to delete it when done&lt;/p&gt;
&lt;p&gt;just running subst with no options will display any currently substituted drives.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Import-PWDocuments issues with drive as InputFolder and long path</title><link>https://communities.bentley.com/thread/685551?ContentTypeID=1</link><pubDate>Fri, 03 Dec 2021 21:27:43 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:921045c4-2b4e-4044-a99d-af145d4400f2</guid><dc:creator>Dan Williams</dc:creator><description>&lt;p&gt;I won&amp;#39;t address your specifics, but when I have run into similar &amp;quot;long paths&amp;quot; issues in the past for various import operations (not all for ProjectWise), one &amp;quot;trick&amp;quot; that I learned from a colleague years ago was to create a share far enough down the path for the source that &amp;quot;works&amp;quot; and mount that share as a drive.&amp;nbsp; Of course if the paths are still too long then you might have to look for an alternative method.&lt;/p&gt;
&lt;p&gt;So you could try creating a share for perhaps a folder &amp;quot;down the tree&amp;quot; like the &amp;quot;GROUPNAME&amp;quot; folder, and then mount that share as drive X:.&amp;nbsp; Then you should be able to import from drive X: at the location in your datasource that matches up with what you intend the full path to be.&lt;/p&gt;
&lt;p&gt;HTHs&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>