Errors when running code below, how do I bypass spaces, commas, parenthesis and slashes that is comes across in the Paths?
$StartLevel = 2 # 0 = include base folder, 1 = sub-folders only, 2 = start at 2nd level
$Depth = 20 # How many levels deep to scan
$Path = “.” # starting path
When you post code, error messages, sample data or console output format it as code, please.
In the “Text” view you can use the code tags “PRE”, in the “Visual” view you can use the format template “Preformatted”. You can go back edit your post and fix the formatting - you don’t have to create a new one.
Thanks in advance.
What should be the result of this code?
Regardless of that: format cmdlets should (almost) always be the last element in a pipeline. It does not make sense to pipe the output of Format-Table to Out-File. A suitable option would be to use Export-Csv.