New
#11
Keith,
The folder was called Repair-Volume [ChkDsk]. After I renamed it Repair-Volume ChkDsk I had correct results.
- To confirm the cause I created another folder with [] in its name and the same thing happened until I removed the [].
- PS cannot accept even a CD command to a folder with [] in its name.
So the problem is solved and I've learnt not to include any symbols in folder names if I want to use PS processing.
This lesson has been valuable so thank you.
Denis
Keith,
And while it had the [] in its name it was count value 0, which makes sense.
I probably have countless folders-files with [] in their names. I have always been able to process them correctly in batch files, vbs & VBA. I'll have to work through a recursive batch file to find them & rename them.
I never use certain symbols, for example &, in folder-file names because they can trip me up in batch file processing even if I think I have provided for them**. But [] have never been a problem before.
{** For instance, using set "SomeVar=this&that" allows many common symbols to get processed without causing problems.}
Denis
I think this is a case where using the -LiteralPath paramater (as opposed to default -Path) will give you correct results:
Code:gci -recurse -Directory | ?{(gci -LiteralPath $_.Fullname -force).count -eq 0} | select @{N = 'gciCount'; E = {(gci -LiteralPath $_.Fullname -force).count}}, FullName | out-gridview
Keith,
You are correct. And I've used -LiteralPath before but had forgotten its significance. I must get around to opening my PS for idiots book and study it properly instead of just stumbling my way through only when I cannot put together a batch file / vbs / VBA solution for something.
Denis