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 8407811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:28:11+00:00 2026-06-09T23:28:11+00:00

I am writing a program to get stored proc’s from xml files. I have

  • 0

I am writing a program to get stored proc’s from xml files. I have the program running on one file. But i need to run it on multiple files. The problem is I find the correct xml files in a large directory.

For example, the path could either be

C:\DevStore\com\dev\Store\sql\store.xml

or

C:\Store\com\dev\DevStore\sql\store.xml

so on….

So, for the above example i can either have DevStore or store, in three possible places.

How can i make the file path use either DevStore or any substring of DevStore in these three place?

I am sorry if the question is unclear, I wasn’t sure how to word it. Thanks in advance!

  • 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-09T23:28:13+00:00Added an answer on June 9, 2026 at 11:28 pm

    Here is some code that you can start your work.

    import java.io.*;
    
    public class Foo {
    
        public static void traverseAndProcess( File startDir ) {
            for ( File f : startDir.listFiles() ) {
                // this file is a directory?
                if ( f.isDirectory() ) {
                    // yes, it is, so we need to go inside this directory
                    // calling the method again
                    traverseAndProcess( f );
                } else {
                    // no, it is not a directory
                    // verifies if the file name finishes with ".xml"
                    if ( f.getName().lastIndexOf( ".xml" ) != -1 ) {
                        // it is a xml (just verifying the extension)
                        // so, process this file!
                        process( f );
                    }
                }
            }
        }
    
        private static void process( File f ) {
            // here you will process the xml
            System.out.println( "Processing " + f + " file..." );
        }
    
        public static void main( String[] args ) {
            // processing the current directory... change it
            traverseAndProcess( new File( "./" ) );
        }
    
    }
    

    My class design is not the best one, but as I said, you can start by the code above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a program where I get information from a page and put it
I'm writing a program that's parsing an XML file to java objects using smooks.
I am using MATLAB to process data from files. I am writing a program
Hey guys I'm writing a simple web program to get my feet wet in
Im writing a program that should read input via stdin, so I have the
I am currently writing a program using Weka that builds a model (using one
I'm writing a program for an ATMega328P that will take readings from several ADC
I'm actually writing about the same program as before, but I feel like I've
I have a binary file and documentation of the format the information is stored
I'm writing a program that, using Rijndael, will encrypt and decrypt files/folders using a

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.