USGS - science for a changing world

Formal metadata: information and software

Formal metadata information and software

Processing many files at once

People sometimes ask me:
How can I run mp on all of the text files in a directory?

Simple batch processing

Because mp processes one file at a time, you'll need to use some other method of running it, and pass it, in turn, the name of each file you want it to process.

In Microsoft Windows, the command prompt has a fairly capable scripting language. In order to run mp on each file in a given directory, you'll want to use the FOR command, like this:

C:> for %F in (*.met) do (mp -c std.cfg %F)
Note that if your metadata records are in XML, just swap (*.xml) for (*.met) in that command. Here I've used the config file to tell mp what sort of output I want it to create and how it should name the output files.


A more sophisticated technique is available if you have some of the rudimentary tools for software development on Unix-like systems, specifically the make utility. This method checks the date and time each file was last modified to determine whether mp needs to be run again, so it helps in managing a collection of metadata where a few files are modified at a time, and you just need to process the ones that were modified.

Accessibility FOIA Privacy Policies and Notices logo U.S. Department of the Interior | U.S. Geological Survey
Page Contact Information: Peter Schweitzer
Page Last Modified: Thursday, 29-Dec-2016 18:18:03 EST