This topic contains 1 reply, has 2 voices, and was last updated by
July 7, 2016 at 1:14 am #46032ParticipantPoints: 0Rank: Member
I want to print out only specific meta data about the files and folders in a remote folder that is accessible via REST commands. I am using this code:
$test = Invoke-WebRequest -Uri "http://acme777.com"
#acme777.com is a Rest URL (semi-website) with a directory of files and other subdirectories
The above two lines of PowerShell code print raw XML data. This data is metadata about the folder found when you browse to http://acme777.com.
How do I make the output print four exclusive types of items? I want to print a list of every file in the directory. So the four things are file name, file size, the user account who created the file (or the name of the file creator), and the time the file was last modified.
Since the current two lines print out data like this:
how do I select the content (or the entire line unformatted) for the four traits of metadata I mentioned?
A helpful response to this post would include generic info about how to do it (e.g., "find the four lines you want returned and use the field descriptor to the left of the equals sign"). I found that piping my two lines of PowerShell code to a "select-string" clause does not help. If a pattern match is found, all the content is returned. Otherwise nothing is returned.
One way around my problem is to redirect the output to a file. I then modify this file and use individual lines separately with the select-string option. I'd rather not use this because of the excessive I/O to the disk.
My main question is, how do I print out only specific XML elements of each file that is listed and returned with my two lines of PowerShell code at the top. A second question is, what is the owner? The account that created the file?
July 7, 2016 at 1:31 am #46036
The topic ‘How do I filter the output of raw XML data?’ is closed to new replies.