diff --git a/entity_staging.services.yml b/entity_staging.services.yml
index f8247df..45ebc13 100755
--- a/entity_staging.services.yml
+++ b/entity_staging.services.yml
@@ -4,7 +4,7 @@ services:
     arguments: ['@entity_type.manager', '@entity_type.bundle.info', '@config.factory']
   entity_staging.export:
     class: Drupal\entity_staging\EntityStagingExport
-    arguments: ['@entity_staging.manager', '@entity_type.manager', '@path.alias_storage', '@serializer', '@file_system', '@event_dispatcher']
+    arguments: ['@entity_staging.manager', '@entity_type.manager', '@path.alias_storage', '@serializer', '@file_system', '@event_dispatcher', '@settings']
   entity_staging.import:
     class: Drupal\entity_staging\EntityStagingImport
     arguments: ['@entity_staging.manager', '@entity_type.manager', '@entity_field.manager', '@event_dispatcher']
@@ -54,7 +54,7 @@ services:
       - {name: event_subscriber}
   entity_staging.export_file_subscriber:
     class: Drupal\entity_staging\EventSubscriber\EntityStagingExportFileSubscriber
-    arguments: ['@entity_staging.manager', '@file_system']
+    arguments: ['@entity_staging.manager', '@file_system', '@settings']
     tags:
       - {name: event_subscriber}
   entity_staging.export_taxonomy_term_subscriber:
diff --git a/src/EntityStagingExport.php b/src/EntityStagingExport.php
index 6d04f35..92d7cf5 100644
--- a/src/EntityStagingExport.php
+++ b/src/EntityStagingExport.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\entity_staging;
 
+use Drupal\Core\Site\Settings;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\entity_staging\Event\EntityStagingBeforeExportEvent;
 use Drupal\entity_staging\Event\EntityStagingEvents;
 use Drupal\Core\Entity\ContentEntityInterface;
@@ -16,6 +18,8 @@ use Symfony\Component\Serializer\Serializer;
  */
 class EntityStagingExport {
 
+  use StringTranslationTrait;
+
   /**
    * The content staging manager service.
    *
@@ -59,6 +63,13 @@ class EntityStagingExport {
   protected $eventDispatcher;
 
   /**
+   * The settings service.
+   *
+   * @var \Drupal\Core\Site\Settings
+   */
+  protected $settings;
+
+  /**
    * EntityStagingExport constructor.
    *
    * @param \Drupal\entity_staging\EntityStagingManager $entity_staging_manager
@@ -73,14 +84,17 @@ class EntityStagingExport {
    *   The file system service.
    * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
    *   The event dispatcher interface.
+   * @param \Drupal\Core\Site\Settings $settings
+   *   The settings service.
    */
-  public function __construct(EntityStagingManager $entity_staging_manager, EntityTypeManagerInterface $entity_type_manager, AliasStorageInterface $alias_storage, Serializer $serializer, FileSystem $file_system, EventDispatcherInterface $event_dispatcher) {
+  public function __construct(EntityStagingManager $entity_staging_manager, EntityTypeManagerInterface $entity_type_manager, AliasStorageInterface $alias_storage, Serializer $serializer, FileSystem $file_system, EventDispatcherInterface $event_dispatcher, Settings $settings) {
     $this->contentStagingManager = $entity_staging_manager;
     $this->entityTypeManager = $entity_type_manager;
     $this->aliasStorage = $alias_storage;
     $this->serializer = $serializer;
     $this->fileSystem = $file_system;
     $this->eventDispatcher = $event_dispatcher;
+    $this->settings = $settings;
   }
 
   /**
@@ -154,9 +168,24 @@ class EntityStagingExport {
    *   The entities type id.
    * @param string|null $bundle
    *   The entities bundle.
+   *
+   * @throws \Exception
+   *   An error occured during treatment.
    */
   protected function doExport(array $translated_entities, $entity_type_id, $bundle = NULL) {
-    $export_path = realpath(DRUPAL_ROOT . '/' . $this->contentStagingManager->getDirectory());
+    $staging_path = DRUPAL_ROOT . '/' . $this->contentStagingManager->getDirectory();
+    // Get system real path.
+    $export_path = realpath($staging_path);
+
+    // Check if staging base path exists.
+    if (!$export_path) {
+      // Attempt to create the staging base path.
+      if (!mkdir($staging_path)) {
+        throw new \Exception($this->t('Could not create base path directory @path', [
+          '@path' => $staging_path,
+        ]));
+      }
+    }
 
     foreach ($translated_entities as $language => $entities) {
       $event = new EntityStagingBeforeExportEvent($entity_type_id, $bundle, $entities);
@@ -170,9 +199,15 @@ class EntityStagingExport {
 
       $entity_export_path = $export_path . '/' . $entity_type_id . '/' . $language;
 
-      // Ensure the directory exists
+      // Ensure the folder exists.
       if (!file_exists($entity_export_path)) {
-        mkdir($entity_export_path, 0777, TRUE);
+        // Attempt to create folder.
+        if (!mkdir($entity_export_path, $this->settings->get('file_chmod_directory', 0775), TRUE)) {
+          throw new \Exception($this->t('Could not create entity @entity path directory @path', [
+            '@entity' => $entity_type_id,
+            '@path' => $entity_export_path,
+          ]));
+        }
       }
 
       if ($bundle) {
@@ -182,7 +217,7 @@ class EntityStagingExport {
         file_put_contents($entity_export_path . '/' . $entity_type_id . '.json', $serialized_entities);
       }
 
-      drupal_set_message(t('Export @entity_type - @langcode - @bundle entities', [
+      drupal_set_message($this->t('Export @entity_type - @langcode - @bundle entities', [
         '@entity_type' => $entity_type_id,
         '@langcode' => $language,
         '@bundle' => $bundle,
diff --git a/src/EventSubscriber/EntityStagingExportFileSubscriber.php b/src/EventSubscriber/EntityStagingExportFileSubscriber.php
index f0587f3..7e58973 100644
--- a/src/EventSubscriber/EntityStagingExportFileSubscriber.php
+++ b/src/EventSubscriber/EntityStagingExportFileSubscriber.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\entity_staging\EventSubscriber;
 
+use Drupal\Core\Site\Settings;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\entity_staging\EntityStagingManager;
 use Drupal\entity_staging\Event\EntityStagingBeforeExportEvent;
 use Drupal\entity_staging\Event\EntityStagingEvents;
@@ -15,6 +17,8 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  */
 class EntityStagingExportFileSubscriber implements EventSubscriberInterface {
 
+  use StringTranslationTrait;
+
   /**
    * The content staging manager service.
    *
@@ -30,14 +34,26 @@ class EntityStagingExportFileSubscriber implements EventSubscriberInterface {
   protected $fileSystem;
 
   /**
+   * The settings service.
+   *
+   * @var \Drupal\Core\Site\Settings
+   */
+  protected $settings;
+
+  /**
    * EntityStagingExportFileSubscriber constructor.
    *
    * @param \Drupal\entity_staging\EntityStagingManager $entity_staging_manager
    *   The content staging manager service.
+   * @param \Drupal\Core\File\FileSystem $file_system
+   *   The file system service.
+   * @param \Drupal\Core\Site\Settings $settings
+   *   The settings service.
    */
-  public function __construct(EntityStagingManager $entity_staging_manager, FileSystem $file_system) {
+  public function __construct(EntityStagingManager $entity_staging_manager, FileSystem $file_system, Settings $settings) {
     $this->contentStagingManager = $entity_staging_manager;
     $this->fileSystem = $file_system;
+    $this->settings = $settings;
   }
 
   /**
@@ -53,17 +69,42 @@ class EntityStagingExportFileSubscriber implements EventSubscriberInterface {
    * Export all files.
    *
    * @param \Drupal\entity_staging\Event\EntityStagingBeforeExportEvent $event
+   *   Received event.
+   *
+   * @throws \Exception
+   *   An error occured during treatment.
    */
   public function exportFiles(EntityStagingBeforeExportEvent $event) {
     if ($event->getEntityTypeId() == 'file') {
-      $export_path = realpath(DRUPAL_ROOT . '/' . $this->contentStagingManager->getDirectory());
+      // Determine staging base path.
+      $staging_path = DRUPAL_ROOT . '/' . $this->contentStagingManager->getDirectory();
+
+      // Get system real path.
+      $export_path = realpath($staging_path);
+
+      // Check if staging base path exists.
+      if (!$export_path) {
+        // Attempt to create the staging base path.
+        if (!mkdir($staging_path)) {
+          throw new \Exception($this->t('Could not create base staging directory @path.', [
+            '@path' => $staging_path,
+          ]));
+        }
+      }
 
       /** @var \Drupal\file\Entity\File $file */
       foreach ($event->getEntities()['file'] as $file) {
         $folder = $export_path . '/files/' . dirname(file_uri_target($file->getFileUri()));
+
+        // Check if folder already exists.
         if (!file_exists($folder)) {
-          mkdir($folder, 0777, TRUE);
+          if (!mkdir($folder, $this->settings->get('file_chmod_directory', 0775), TRUE)) {
+            throw new \Exception($this->t('Could not create file directory @path.', [
+              '@path' => $folder,
+            ]));
+          }
         }
+
         file_put_contents($folder . '/' . $this->fileSystem->basename($file->getFileUri()), file_get_contents($file->getFileUri()));
       }
     }
