# distZip rename rootFolder and artifact

**URL:** <https://discuss.gradle.org/t/distzip-rename-rootfolder-and-artifact/23926>\
**Category:** Help/Discuss\
**Created:** [August 30, 2017, 1:34am UTC](https://discuss.gradle.org/t/distzip-rename-rootfolder-and-artifact/23926 "2017-08-30T01:34:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hangzhang925](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@hangzhang925](https://discuss.gradle.org/u/hangzhang925)\
**Post date:** [August 30, 2017, 1:34am UTC](https://discuss.gradle.org/t/distzip-rename-rootfolder-and-artifact/23926/1 "2017-08-30T01:34:30Z")

</div>

I learned the way from the post below to make Zip file and root folder have different name :

> [@Customise distZip to change root directory name](https://discuss.gradle.org/t/customise-distzip-to-change-root-directory-name/17622):
>
> I’m using distZip to produce a zipped distribution of my project. The current task creates a zip file with a single directory at the root called MyProject-version. Is there a way to change this to MyProject? (i.e. lose the trailing version number) Thanks

Now:  
my zip file name is : sampleFile-1.0.0.ZIP  
my root folder name is: sampleFile  
The problem is : Since i set the archiveName to sampleFile, artifact is looking for sampleFile instead of “sampleFile-1.0.0.ZIP”, how shall i handle this case?

```
configurations {
  dist
}

artifacts {
  dist distZip
}

distZip {
  archiveName "sampleFile"

  doLast {
    String zipFinalPath = $destinationDir + baseName + '.zip'
    file("$destinationDir/$archiveName").renameTo(zipFinalPath)
   
  }
}

```
