Home

Awesome

addext

Version: 2.0.1

Build Status

Python script to add file extensions to files without them, based on Siegfried format identification.

Calling addext

addext.py takes two positional arguments:

Options include:

Behavior

Default mode

In its default mode, addext adds file extensions to files if they meet a few conditions:

If all conditions are met, addext adds the file extension to the file in-place. It is recommended that you try a dry run first to evaluate the proposed changes before renaming files.

Manual mode

In -m, --manual mode, addext follows the following logic:

Note that for directories with many files, going through the files one-by-one in manual mode may take some time. Running addext as a dry run in manual mode may help give an idea of the extent of manual choices you will be asked to make.

Due to its dependency on Inquirer, manual mode is not available on Windows.

Requirements

Installation

Install Siegfried

Install Siegfried following the instructions found here.

Install via git clone/download

The easiest way to use addext is to clone or download this repository and then run the script with python3 /path/to/addext.py [options].

If taking this route, install additional Python library dependencies: pip install -r requirements.txt or pip install inquirer (this may require sudo permissions).

Install via PyPI

addext can also be installed via pip install addext. This will install a script in the /usr/local/bin directory (assuming a Linux/macOS installation) so that addext can be called from anywhere with simply addext.py [options].

Note that following installation, you will need to download or create a PRONOM JSON file to use with addext.

PRONOM JSON file

Description

The PRONOM JSON file is a lightweight representation of information from PRONOM needed for addext to function. The file contains an object for each format described with a PRONOM ID (PUID), structured like the following example:

"fmt/858": {
    "file_format": "Navisworks Document",
    "version": "2010",
    "file_extensions": [
      "nwd",
      "nwc"
    ]
  }

Updating the PRONOM JSON file

pronom_v95.json is currently up-to-date with PRONOM release v95.

To create a new PRONOM JSON file (for instance, after a new PRONOM release):

Creators

This project was initially developed in 2016-2017 for the Canadian Centre for Architecture by Tessa Walsh, Digital Archivist, as part of the development of the Archaeology of the Digital project.