diff --git a/bilby/core/sampler/dynesty.py b/bilby/core/sampler/dynesty.py
index 62f2171234df56af13660b8caa602b5d6813c525..23bdf8b701401b7591e734b3009aee256bf9a7a2 100644
--- a/bilby/core/sampler/dynesty.py
+++ b/bilby/core/sampler/dynesty.py
@@ -5,7 +5,7 @@ import sys
 import numpy as np
 from pandas import DataFrame
 from deepdish.io import load, save
-from ..utils import logger
+from ..utils import logger, check_directory_exists_and_if_not_mkdir
 from .base_sampler import Sampler, NestedSampler
 
 
@@ -282,6 +282,7 @@ class Dynesty(NestedSampler):
         sampler: `dynesty.NestedSampler`
             NestedSampler to write to disk.
         """
+        check_directory_exists_and_if_not_mkdir(self.outdir)
         resume_file = '{}/{}_resume.h5'.format(self.outdir, self.label)
 
         if os.path.isfile(resume_file):