So, I'm tryng to create a folder, where i merge 2 strings and Get Date; like this:
2345__OPEXs_datetime
My code:
Get-ChildItem 'C:\Scripts\MetadataExport' | New-Item -Name (Get-ChildItem 'C:\Scripts\MetadataExport' -Name).Split('-')[2] + '_XIPs' + "_$((Get-Date).ToString('yyyy-MM-dd'))" -ItemType Directory -Force
But it's gives-me the follow error:
New-Item : A positional parameter cannot be found that accepts argument '_XIPs'.
At line:1 char:45
+ ... taExport' | New-Item -Name (Get-ChildItem 'C:\Scripts\MetadataExport' ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand
Can you help-me to figure it out what i'm doing wrong?
Best