I need to write some software to catalog files in a directory hierarchy. The directories of this hierarchy nominally follow
this structure:

Country
City
Technology_Type
Date

Files are then placed under the Date directory. The problem is that until now, files are copied into the hierarchy manually. Occaisionally files have been placed in the wrong spot, and directories below the top level have, occasionally, been created at the wrong spot, or out of order, in the hierarchy.

My initial approach is to use the directory information as meta data (country, city, date) to generate a database entry for each file. While I can recursively traverse the directories, I'm not sure of the best approach to verify (or determine) that a directory that I think is, say, a city, really is a city; not a tech_type.

The directory holds a sufficient number of files (> 1 million) to make manual cleanup a non-starter. This is more theory oriented question, I suppose, but since I will be doing this in Java I put it here. Thanks for any pointers.

Is this a java programming problem or a database usage problem?

Is this a java programming problem or a database usage problem?

I guess I should have put my last sentence at the beginning. This is probably more of theory question than Java or DB specific. Perhaps it should be moved. If so, I don't know to which topic.

Sorry for the confusion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.