Deleting Samplitude .H2 and .HDP files

I occasionally use Samplitude for audio editing and mastering. As with many other DAW’s, Samplitude creates peak files which it uses to graphically render waveforms quickly. Unfortunately, unlike many other DAW’s, Samplitude offers no way to set a universal path for this, instead they are always stored adjacent to the associated audio file.

This isn’t usually much of a problem if you’re working in projects, but if like me you’re using samplitude for editing single files in your sample library it will start pollute your folders with peak files.

Creating batch scripts

To remedy this I use a windows batch script. If you’re unfamiliar with these they are effectively text files with a ‘.bat’ extension that can execute various commands in the windows shell when they’re run. They’re easily made, simply open Notepad, type out your script (or copy/paste from a tutorial online) and save it as a ‘.bat’ file.

Running batch scripts

You just have to ‘run’ the batch script like a normal executable so see it do its thing. If you haven’t set a target folder within the script it’ll operate on the contents of the folder it’s in. This means copying the batch script into the folder you want to perform the operation, executing it, and then deleting the batch script (or not, if you might need to run it again in that location in future).

I have a Batch Scripts folder in My Documents which contains master copies of my scripts, ready to be copied into folders whenever I need them. However, I’ve recently started using Directory Opus (DOPUS) which is a windows explorer replacement that supports heavy customisation. This includes the ability to create custom toolbars with icons that amongst other things can call embedded batch scripts. This means I just have to navigate to a folder that needs clearing-up, hit my ‘Samplitude Clean-Up’ button and it’ll work its magic nearly instantly.

Gif showing the deletion script being executed in Directory Opus
Running the script in DOPUS. The icon on the right triggers the script. The red files are recent files (in this case the ones we’re deleting).

Cut to the chase – my Samplitude clean-up script

The batch script I use consists of the following two lines:

del *.H2 /s /f /q
del *.HDP /s /f /q

A full break-down of the first line of the script:

del : delete files that match the following criteria
* :  target all filenames
.H2 : target files with the .H2 extension
/s : also target files in subdirectories
/f : force delete of read-only files
/q : quiet mode, don't prompt the user for confirmation of deletion

As you see, each line is a duplicate of the other. One concerns deleting all .H2 files, while the other handles .HDP files. The text following that are called arguments, which are additional instructions for the batch command to control what it’s going to do.

Other batch script uses and Reaper peaks

Basic batch script use is a pretty useful thing to have in your toolbox so I recommend looking into seeing if there are ways they can improve your workflow. I use them in a number of ways when working on game audio, including:

  • repeatable file copying (if I’m often moving files from one specific folder to another)
  • creating text files listing files and folder structures (for providing a simple overview of my sample library)
  • counting files in subfolders and outputting the numbers to a text file (useful if I want a breakdown of the number of wav files in a project or sample library I’m making)
  • prefixing and suffixing UCS information

If you’re a heavy Reaper user (as I am), it’s easy to adapt the above script to clear out .reapeak files, although personally I have these set to propagate in a temp folder. Hmm, maybe I should make a script to clear-out files older than six months from my various temp locations… that’d be pretty useful…

If you’ve got any questions or want to share your batch script use you can find me on Twitter @monomoon_sound