Tips: File Renames

Register BSAs Cleaning Plugins OPENMW_PHYSICS_FPS Shiny Meshes INI Importer TR Patcher Atlased Meshes BBC Patching

Many texture mods that use special maps (normal, specular, etc) and are made for vanilla Morrowind have a filename like this:

tx_glass_amber_redoran_nm.dds

Or this:

tx_glass_amber_redoran_normal.dds

Or anything that's not _n.dds, in the case of a normal map. Some mods may even ship with a file name like _normals.dds. In these cases, the best way to ensure they work with OpenMW is to rename the files to conform to what OpenMW expects them to be by default.

Linux/macOS/Other UNIX

The following is for advanced users only! On UNIX-like OSes such as Linux or macOS, a simple command-line can be used:

If you aren't comfortable or at least a little familiar with using shell commands, do not just try to copy paste what's below. I am not responsible for problems caused by improper shell usage!

#!/bin/bash

# Establish an absolute dir path.
this_dir=$(realpath $(dirname ${0}))

# Forloops have trouble with things that have spaces in the name.  Fix that.
oldifs=$IFS
IFS=$(echo -en "\n\b")

# Files first.
for f in $(find -type f "${this_dir}" -iname "*_nm.dds"); do
    mv -iv $f $(echo $f | sed 's|_nm|_n|g')
done

# Then dirs.
for f in $(find -type d "${this_dir}" -iname "*_nm.dds"); do
    mv -iv $f $(echo $f | sed 's|_nm|_n|g')
done

# Restore $IFS
IFS=$oldifs

And so on. Usual command-line tools such as rename don't do the job since file names can have spaces and other quirks that cause failures and unexpected results.

So when file renames are needed, simply adapt the examples seen above (inserting echo as needed for dry-runs) for the file name changes you need.

Windows

As is mentioned above in the UNIX section, the following is for advanced users only! I am not responsible for bad things you do via command line mishaps!

Now, where were we? The above could work if you're a user of the Linux Subsystem For Windows stuff, but for a more native solution one can use PowerShell commands:

# Renames all _nm.dds files to _n.dds, run this after cd'ing to C:\games\MorrowindMods
Get-ChildItem '*_nm.dds' | Rename-Item -NewName {$_.Name -replace '_nm.dds','_n.dds'}

Register BSAs Cleaning Plugins OPENMW_PHYSICS_FPS Shiny Meshes INI Importer TR Patcher Atlased Meshes BBC Patching

About Getting Started CFG Generator Name Generator Mod Lists Load Order Resources Tips FAQ Contact Feedback Issue Tracker Source Code #momw on Freenode TES3MP Server
All original content on this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Creative Commons License