Export files to multiple directories

I use Ardour for working on sound effects for a video game project. The sound effects are split into multiple directories. There’s a lot of sound effect group, as this is a big project.

Right now I’m using multiple CD ranges + Location Markers and manually change the export directory to export groups of sounds that belong in a common directory.

I’d be fantastic, if Ardour had some way to define per CD-region export directories (either relative to export or absolute). This would save me a lot of time and speed up my workflow immensively.

Now I have to manualy do this:

  1. Change the export directory
  2. Select correct CDranges for export
  3. Export
  4. Move the files to correct game assets folders.
  5. Repeat from 1 for the next effect group

If Ardour allowed me to define the export directory for each CDrange (and allow me to copy/paste them in Locations etc.) I could just update my effects and perform a single Export and have it all update in the game immediately.

I could try and make a script that’d move files to appropriate directories after the export, but I’m using Windows for this project and I am not capable of making .bat scripts.

Maybe there’s some Lua script that could help me out?

1 Like

I don’t think there is yet, but this is a perfect point where a lua script could help.


Maybe the simplest solution would be to parse some special characters in CD-range names and use that for export paths?

I’ve tired first to just prepend a relative path, but Ardourt removed problematic chartacters and ignored my attempt :smiley:

CD-range name:


Expected outcome:


Actual outcome:


It’d be ugly, but it could work, until we figure out something more elegant.
I wonder if other DAWs have such an option.

Yes, that is what post-export hooks are intended for. It is also currently the only location that has all required context. %N (timespan name) in particular.

That is too bad. On unix systems it would be trivial to just move files %f to a target-folder using indirection. The target folder can be a symbolic link from timespan-name (CD marker name) %N to collect the files.

I guess if you know the CD-markers a-priori, you could still write a .bat script.

Nope. Export is done using a “mini Ardour” inside of Ardour. Scripting is not available for that.
I wish I had better news.

That is unlikely to happen. CD regions in particular are usually expected to be in the same folder.

That’s also not a bad idea. You can just post-process that with a script to move the files, chopping off the part before the first underscore.

A very similar issue with a solution using either the windows power-shell or .bat:

Thanks! I think I’ll try that.

I ended up writing a Bash script in CygWin:


rm files.txt
ls . | grep -v .txt | cut -d'/' -f 2- > files.txt
while read line; do
        name=$(echo $line | cut -d'_' -f2-)
        group=$(echo $line | cut -d'_' -f1)

        new_path=$(grep $group ./dispatcher.txt | cut -f2-)

        echo -e "Group: $group\tname: $name\t\t\tnew_path: $new_path"

        cp "$line" "$new_path/$name"

done < files.txt

Requires a file dispatcher.txt containing paths like this:

0001     (tab)    /cygdrive/c/new/path
0002     (tab)    /cygdrive/c/different new path/

Put dispatcehr.txt into your export dir, add prefixes to CD range names like:

file1 -> 0001_file` etc.

Run the script in the export dir and you should be good.

I now will try to integrate this with Ardour’s export process.

EDIT (2020.01.17):
Fixed a bug where more than one underscore would cause problems.

I wasn’t able to start my script directly from Ardour. Also - it’s supposed to start the command for each file, right? I made my script to deal with all files at once.

I’ve created a Batch file like this:

PATH=C:\cygwin64\bin;%PATH% && C:\cygwin64\bin\bash.exe '/cygdrive/c/Users/unfa/Documents/Scripts/dispatcher/dispatcher.sh' '/cygdrive/c/Users/unfa/Documents/Projects/Sound Effects/export'

Running this batch file now does what I want, but I can’t make it run automatically and only once after all files have been exported. Not a big problem ,I an just do it manually, but maybe such an option would be nice.

Pasting the batch path into the post-export command field doesn’t seem to do anything.

There must be a single command there. The first parameter needs to be an executable.
e.g. C:\foo\bar\baz.exe %d

Check Menu > Window > Log for error messages.