Reputation: 8164
I'm using PowerShell to import CSV file but get this error:
Unable to find the specified file.
The file name is generated automatically by system performance counters collector. "Oracle_Data_Provider_for_.NET(defaultdomain [10148, 1]).csv"
If I rename file to "Oracle_Data_Provider_for_.NET(defaultdomain 10148, 1).csv" the file opened correctly.
The version of PowerShell is:
PS U:\> $PSVersionTable Name Value ---- ----- PSVersion 4.0 WSManStackVersion 3.0 SerializationVersion 1.1.0.1 CLRVersion 4.0.30319.18444 BuildVersion 6.3.9600.16406 PSCompatibleVersions {1.0, 2.0, 3.0, 4.0} PSRemotingProtocolVersion 2.2
Any suggestions for how to fix?
Upvotes: 0
Views: 304
Reputation: 200193
Square brackets are wildcard characters. If you have literal square brackets in a filename you need to use the -LiteralPath
parameter:
-LiteralPath<String[]>
Specifies the path to the CSV file to import. Unlike Path, the value of the LiteralPath parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.
Example:
Import-Csv -LiteralPath "Oracle_Data_Provider_for_.NET(defaultdomain [10148, 1]).csv"
Upvotes: 3