My script exits when it hits a long path name (>= 260 characters). How could I change my snippet to capture long path names in my tif to pdf conversion. Or is it easier/better to simply dirlist all the files<260 characters and apply the script on them alone (I still wouldn't know how to tackle the remaining long name files)?
SNIPPET: (this works as long as the pathname is <260 characters)
$tool = 'C:\Program Files\ImageMagick-7.0.1-Q16\magick.exe'
$source = "\\my\path"
Get-ChildItem -Path $source -filter longnames*.tif | %{ & $tool convert "$($_.FullName -Replace ".tif+$", ".tif[0]")" "C:\Data\$($_.Name -Replace ".tif+$", ".pdf")" }
From reading this blog+posts, it seems I need to use the syntax
[Alphaleonis.Win32.Filesystem.File]::<some AlphaFS function here?>
but I need some further guidance or examples related to my application.
I'm on Windows Server 2012 R using Powershell v 4 and I've got the AlphaFS library installed. I am using imagemagick to convert the first page of a PDF to TIF.