Get-ChildItem \\host1\dir\ -recurse -Filter *.txtthis command searches all the text files recursively in the dir folder , i want to start the search from dir1 for instance which is a child folder of dir and i am unable to make this work Get-ChildItem \\host1\dir1\ -recurse -Filter *.txt the error was the file does not exist, the dir1 folder is present inside d directory .How can i directly find a file in the dir1 folder.
file hierarchy
0dir
--d
--dir1
1 Answer
You can't enumerate a drive starting from a none existing path.
Change
Get-ChildItem \\host1\dir1\ -recurse -Filter *.txtto
Get-ChildItem \\host1\dir\d\dir1\ -recurse -Filter *.txt 3