Skip to content

Import-Csv fails to bind Get-ChildItem output to its -LiteralPath parameter via the pipeline #4473

@mklement0

Description

@mklement0

Related: #4472.

The -LiteralPath parameter, via its -PSPath alias, is normally used to bind to objects piped from Get-ChildItem / Get-Item, such as with the Get-Content cmdlet.

Import-Csv currently fails to establish this binding.

Steps to reproduce

'file1.csv', 'file2.csv' | % { $null > $_ }
Get-ChildItem file*.csv | Import-Csv

Expected behavior

Binding of the [System.IO.FileInfo] instances via their .PSPath property to -LiteralPath, and therefore no output (null collection), given that both files are empty.

Actual behavior

The following statement-terminating error is reported:

Import-Csv : You must specify either the -Path or -LiteralPath parameters, but not both.

Environment data

PowerShell Core v6.0.0-beta.4 on macOS 10.12.5
PowerShell Core v6.0.0-beta.4 on Ubuntu 16.04.2 LTS
PowerShell Core v6.0.0-beta.4 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Windows PowerShell v5.1.15063.413 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions