# How to customize file name when downloading

**URL:** <https://forum.ecmwf.int/t/how-to-customize-file-name-when-downloading/7345>\
**Category:** API\
**Created:** [31 October 2024 07:28 UTC](https://forum.ecmwf.int/t/how-to-customize-file-name-when-downloading/7345 "2024-10-31T07:28:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junya\_Wu](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/j/d78d45/32.png) [@Junya\_Wu](https://forum.ecmwf.int/u/Junya_Wu)\
**Post date:** [31 October 2024 07:28 UTC](https://forum.ecmwf.int/t/how-to-customize-file-name-when-downloading/7345/1 "2024-10-31T07:28:54Z")

</div>

Hi guys,  
I was downloading ERA5 daily maximum data using API request python code.  
I would like to customize the filenames of the downloaded data instead of having them assigned automatically. Could you please guide me on how to modify the script to achieve this? Thanks.

import cdsapi

#YEARS = range(1961,1962)

#for year in YEARS:

# pass

dataset = “derived-era5-single-levels-daily-statistics”  
request = {  
“product\_type”: “reanalysis”,  
“variable”: [“2m\_temperature”],  
“year”: “1961”,  
“month”: [  
“01”, “02”, “03”,  
“04”, “05”, “06”,  
“07”, “08”, “09”,  
“10”, “11”, “12”  
],  
“day”: [  
“01”, “02”, “03”,  
“04”, “05”, “06”,  
“07”, “08”, “09”,  
“10”, “11”, “12”,  
“13”, “14”, “15”,  
“16”, “17”, “18”,  
“19”, “20”, “21”,  
“22”, “23”, “24”,  
“25”, “26”, “27”,  
“28”, “29”, “30”,  
“31”  
],  
“daily\_statistic”: “daily\_mean”,  
“time\_zone”: “utc+00:00”,  
“frequency”: “1\_hourly”,  
“area”: [30.75, 113, 23.75, 119]  
}

client = cdsapi.Client()

filename = “era5-daily-mean-2mT-1961.nc”

client.retrieve(dataset, request).download(filename)

---

<div class="post-metadata">

**Author:** ![Michela](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/m/898d66/32.png) [@Michela](https://forum.ecmwf.int/u/Michela)\
**Post date:** [4 November 2024 17:30 UTC](https://forum.ecmwf.int/t/how-to-customize-file-name-when-downloading/7345/2 "2024-11-04T17:30:22Z")

</div>

Hi,  
if you want to name the downloaded files please use this:

```
filename="era5-daily-mean-2mT-1961.nc"
client.retrieve(dataset, request, filename)

```

Thanks
