Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9206283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:08:35+00:00 2026-06-18T00:08:35+00:00

On a Windows 7 PC, I’m trying to generate a single comma-delimited text file

  • 0

On a Windows 7 PC, I’m trying to generate a single comma-delimited text file from data contained in several hundred xml files. Each xml file is contained in its own uniquely-named folder, but each instance of the xml file has the same file name, “report.xml”

To be more clear, the folder / file structure is something like this:

H:\Main_Folder\Folder_1\report.xml
H:\Main_Folder\Folder_2\report.xml
H:\Main_Folder\Folder_3\report.xml
...

The xml files contain lots of data, but I am only interested in a couple of data items, which happen to be measurements. Ultimately, my desired output is a text file that would list, for every folder, the folder name and the two measurements from the xml file:

folder_1 , measurement_1 , measurement_2
folder_2 , measurement_1 , measurement_2
folder_3 , measurement_1 , measurement_2
...

Within any folder, I am able to get the values I want from a single xml file with the following PowerShell code:

$xml = [xml](get-content report.xml)
$xml.Measurement[0].Value.'#text' + " , " + $xml.Measurement[1].Value.'#text'

The above code returns:

measurement_1 , measurement_2

Also, I can move through each folder and output the folder name with the following PowerShell code:

PS H:\Main_Folder> Get-ChildItem Report.xml -Recurse | Split-Path -parent

When executed, this gives me:

folder_1
folder_2
folder_3
...

I need some help to figure out how to get all of this to work together to produce my desired text file. Many thanks for your assistance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:08:36+00:00Added an answer on June 18, 2026 at 12:08 am

    something like this

    ls h:\main_folder -filter "report.xml" -recurse|%{
        [xml]$xml=gc $_.FullName
        $_.DirectoryName+","+$xml.Measurement[0].Value.'#text' + " , " + $xml.Measurement[1].Value.'#text' |out-file c:\temp\output.csv -Append
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
Windows fails to pick up my .hgignore file. I'm running Mercurial from the command
Windows - I am trying to create a new Tar file with with the
Windows provides only GetTickCount up to Windows Vista and starting from that OS also
Windows phone performance analysis creates a file with .sap extension. This .sap file is
Windows already contains dialogs to choose a file or printer. Is there a built-in
Windows explorer in XP will allow you to make a file selection based on
Windows Mobile 6.0 devices have a Text Size setting that can be reached by
Windows XP with Service Pack 3 x86 retail symbols, all languages (File size: 209
Windows has this type of thing with TCP packets already (Hosts File), is there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.