I\'m trying to build a comma separated list of file names in a specific folder. These files tend to have long names (they\'re test case results and the name is very descript
This seems to be a really popular question because it has been asked multiple times on this site.Anyway here are your alternatives:
Use Pinvoke
Boe Prox - Technet
Use Robocopy
Boe Prox - Technet
Use AlphaFS with Powershell V5 and V4
if you can find a computer with PowerShell v5 (windows 10 comes with PS v5) you can install a module called PSAlphaFS .
Install-Module PSAlphaFS
by default the modules from powershellgallery get installed to
C:\Program Files\WindowsPowerShell\Modules
Note:The PSAlphaFS module can also be run on a target system with PowerShell V4 but not on powershell V3.
Here is how you can find out the version of Powershell that is currently running.
$PSVersionTable.PSVersion
Once the module is in place you can then run the following command which is similar to get-childitem but without the 260 char limitation.
Get-LongChildItem -Filter *.txt -Name