2

I am trying to filter my files based on certain criteria and return a list of all items (including their parent directories)

Here is what I have for example

get-childitem ./ -Recurse -Filter "*&*" | ? { $_.PSIsContainer } | Select-Object -Propety Name

This does return all of files I want in this format

  • File 1.txt
  • File 2.txt
  • File 3.txt

I was wondering if there would be a way to have them dislay like this:

  • Folder 1/Folder 2/File1.txt
  • Folder 3/File 2.txt
  • Folder 3/Folder 4/File 3.txt

The folders are in no particular order or layout, so I would just like to get the full path of the file.

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
shenn
  • 859
  • 4
  • 17
  • 47

1 Answers1

5

Just select the FullName

get-childitem ./ -Recurse -Filter "*&*" | 
        ? { $_.PSIsContainer } | 
        Select-Object -Property FullName
Rynant
  • 23,153
  • 5
  • 57
  • 71