# Export files

**URL:** <https://forums.creativeclouddeveloper.com/t/export-files/3155>\
**Category:** UXP Plugin API\
**Created:** [June 23, 2021, 11:15am UTC](https://forums.creativeclouddeveloper.com/t/export-files/3155 "2021-06-23T11:15:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mateszkom](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/mateszkom/32/1580_2.png) [@mateszkom](https://forums.creativeclouddeveloper.com/u/mateszkom)\
**Post date:** [June 23, 2021, 11:15am UTC](https://forums.creativeclouddeveloper.com/t/export-files/3155/1 "2021-06-23T11:15:54Z")

</div>

i’m trying to export multiple versions of my artboards (change text, fit to center etc)  
The problem is that when I do loop files just do not export.  
I think is a problem with synchronicity, I can be wrong.

QuickExport function

```auto
async function quickExport(destFolder, layerOnly = false, fileType) {
  try {
    await batchPlay([
      {
        _obj: layerOnly ? "exportSelectionAsFileTypePressed" : "exportDocumentAsFileTypePressed",
        _target: { _ref: "layer", _enum: "ordinal", _value: "targetEnum" },
        fileType: fileType,
        quality: 90,
        metadata: 0,
        destFolder,
        sRGB: true,
        openWindow: false,
        _options: { dialogOptions: "dontDisplay" },
      },
    ], { synchronousExecution: false })
  } catch(e) {console.error(e)}
}

```

and applyDataset&export function

```auto
var countries =["PL","EN","CZ","SK","DE","RO","HU","LT","LV","EE","HR","RU","UA","FR","ES","IT","SL"];
async function exportThings(){
  for (country of countries) {
    await applyDataSet(country);
    countryFolder = dataFolder.nativePath + '/' + fileName + '/' + country;
    await quickExport(countryFolder, false, "jpg")
  }
}

```

I can make sleep for couple seconds after every export but its not optimal

---

<div class="post-metadata">

**Author:** ![Dawn](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@Dawn](https://forums.creativeclouddeveloper.com/u/Dawn)\
**Post date:** [February 23, 2022, 6:37am UTC](https://forums.creativeclouddeveloper.com/t/export-files/3155/2 "2022-02-23T06:37:26Z")

</div>

change quality: 32 and you will find it work sucessly.
