User Tools

Site Tools


misc_tools

Misc Tools

This page is a list of tools that might be useful

Utilities

Batch file renaming

You can use Adobe Bridge to execute complicated file rename commands on bulk items. Very useful. There are several combinations depending on how you want to rename, here is the most common.

To change a filename for a batch of images with one sequential number per file (e.g 847.tif > mufs001-i0091-001.tif)

PART I

  1. Open Adobe Bridge
  2. Navigate to the folder with the files you want to rename.
  3. Select all of the files you want to rename and select Batch Rename.
  4. Select the destination folder in the Batch Rename dialog box.
  5. In the New Filenames dialog box select TEXT as the first command and enter all the characters up to the number that needs to change sequentially. (e.g. “mufs001-ii-i”)
  6. Select SEQUENCE NUMBER as the second command. The enter the number you want to begin with and the number of digits. You will see a preview of what the first new filename will look like in the preview below.
  7. Hit RENAME then continue to Part II below to add the part #.

PART II

  1. Select the same group of files and select Batch Rename.
  2. In the Batch Rename dialog box select the CURRENT FILENAME command and select NAME and ORIGINAL CASE.
  3. As the second command select the TEXT command and add “-001”. This will append an -001 to all of the files.

Insert new elements to multiple files in oXygen

To insert new elements to a batch of files

  1. Go the spot in the hierarchy where you wish to insert the new element, right click and choose Copy Xpath
  2. Open Find>Find/Replace in Files…
  3. In the Text to find: box put the xml of the element below where you want to insert your element
  4. Check the Regular expression box
  5. Paste the Xpath you copied into the Restrict to XPath: box
  6. In the Replace with box put the element, attributes, and content you wish to insert. Add “\n$0”, without the quotes, to the end of the element data. This inserts the element on a new line and puts back the data in the Text to find: box
  7. Select the file path where the files are in Specified path:
  8. Hit Replace All (But test it on a few records first!)

stripids.py

This script will generate a list of IDs from a page of mods-search results. Type:

$ stripids.py /path/to/idlist.txt “http://localhost:8080/?q=prophet&field=full

The command above will create a file called idlist.txt that has all the item IDs from the search results page in the URL.

This list can be used with extract.py.

extract.py

Usage:

This script will extract all the files that match a list of item IDs and optionally convert the files into additional formats.

The full list of options:

Options:
  -h, --help  show this help message and exit
  -l LIST     List of items to extract
  -o OUTDIR   Specify output directory
  -j          Convert tiff to jpeg
  -m          Include metadata with files
  -d          Create DC record.  Used with -m option

To simply extract the TIFF files for a list of items, type:

extract.py -l /path/to/itemlist.txt -o /path/to/dir/

If you want to extract the TIFF files and the metadata:

extract.py -m -l /path/to/itemlist.txt -o /path/to/dir/

If you want to convert the files to Web optimized jpegs and the metadata to Dublin Core:

extract.py -jmd -l /path/to/itemlist.txt -o /path/to/dir/

To create a PDF of the extracted TIFFs or JPEGs, highlight all the files you want to bind together, right-click, and choose “Combine supported files in Acrobat.”

 Combine files in Acrobat

fixauthority.py

Usage:

This script is a little less user-friendly but could save time if there are a large number of changes to make.

FIXME

misc_tools.txt · Last modified: 2019/11/19 18:50 (external edit)