Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Files and Folders

$
0
0

Are you only looking to access a parent folder (test) and one subfolder (a)? Or are you only excluding one subfolder (b)? If there are only 2 subfolders then the logic works both ways but it depends how you want your script to handle c:\test\c.

Writing code on an ipad in a hotel room is tricky so I’ll give some suggestions.

The obvious start is get-childitem c:\test and from there you will filter down to the files you want to list. My first thought is to use -recurse and then pipe the result to where {$_.foldername -eq ‘b’} (that’s probably the wrong property name, you will need to check). A final pipe to select name, length should do it (length is size for files as I recall). This is off the top of my head of course so you would need to test and expand on it.


Viewing all articles
Browse latest Browse all 13067

Trending Articles