5
1
I'm trying to get a list of all the directories and files on an external hard drive, with one fully-qualified directory/file path per line. I'm using PowerShell on Windows 10 to achieve this. This is the PowerShell command I'm using:
Get-ChildItem 'E:\' -Force -Recurse | Select-Object FullName | Out-File -Encoding utf8 "C:\Users\Me\Desktop\listing.txt" -width 300
However, some paths are being truncated in my output. In fact, over 10,000 lines are truncated. Here is an example of one line in my listing.txt PowerShell output file:
E:\Sort\Tech Stuff\2006-2007 CompanyLtd\fsie01-Engineering-Users-User1\Reference\LCID & Language Group by Language\Configuring and Using International Features of Windows Windows 2000 - List of Locale I...
When I browse to this directory in File Explorer (E:\Sort\Tech Stuff\2006-2007 CompanyLtd\fsie01-Engineering-Users-User1\Reference\LCID & Language Group by Language), the file there is called 'Configuring and Using International Features of Windows Windows 2000 - List of Locale IDs and Language Groups.url'. The path of this file is 228 characters long if I haven't miscounted, which should be within acceptable limits.
What am I doing wrong that is truncating the paths in my PowerShell output?
Thanks - that seems to allow me to get the output I want. However, there's still no explanation as to what was wrong with my initial command, which looks like it should do what I want. Any idea? It's not intuitive that paths would be (apparently arbitrarily) truncated at ~205 characters unless one uses a format-table command. – osullic – 2016-03-07T13:18:00.257
1For me
Format-Table -AutoSize
didn't help and strings were truncated anyway, whilst-width 300
did – Suncatcher – 2018-05-29T09:53:59.837