Find a particular folder and find files recursively

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

dir

--d

--dir1

0

1 Answer

You can't enumerate a drive starting from a none existing path.

Change

Get-ChildItem \\host1\dir1\ -recurse -Filter *.txt

to

Get-ChildItem \\host1\dir\d\dir1\ -recurse -Filter *.txt
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like