Forum Discussion
wordconv - unable to exclude .docx
Harm_Veenstra
Hello,
does it works for you?
i tried it -> no way. in my $FILEDOC there are .docx .ps1 file, not only .doc
Nicktab
I created a test folder with a docx and doc file:
When I run this, I only get the docx file:
C:\Users\HarmVeenstra> Get-ChildItem -LiteralPath d:\temp\test -Recurse -Include *.docx -name
New Microsoft Word Document.docx
When I run this, I only get the doc file:
C:\Users\HarmVeenstra> Get-ChildItem -LiteralPath d:\temp\test -Recurse -Include *.doc -name
New Microsoft Word Document.doc
So the -Include doc does work in my opinion 🙂
- NicktabJun 02, 2023Copper Contributor
Hi,
i tested it again... i found why it works for you and not for me. Try it without recurse... you'll get every files, not only the included file . i don't want to get all subfolders file but only the first level of folder, i cannot use recurse. Thank you anyway 🙂
i'll continue my script with this
$FILEDOC = Get-ChildItem -LiteralPath "$PATH" -Name -File
foreach ($DOC in $FILEDOC)
{
if ($DOC -like "*.doc" -and $DOC -notlike "*.docx")
{
blablabla
}
}