I share an example script from my repository, which should give you some inspiration as to how you can automate/concatenate the file/folder naming process. In this example, I have 3 images and 10 regions, and my objective is to do the following; clip each image to each of the 10 regions, reclassify them and export them to Google Drive.
Hopefully you can understand it, and adapt it for your purposes. Specifically, you can take direction from my code and modify your script in the export parameters:'folder'. Feel free to post your code here so the community can view/reproduce/comment on it.
As a closing note, when you are exporting images from GEE, you should always specify the arguments 'region' and 'scale'. In some cases, if you do not specify, region, the export's extent will default to the extent in your view-port (i.e. the map viewer in GEE code editor).
Disclaimer: there may be many other methods to achieve your goals that are superior to mine, but this is the only one that I know of at the moment. Hope this helps.
Warmest regards,
J Johanness
// Load vector boundary
var boundary = ee.FeatureCollection('XXX');
// Define start and end value for vector layer attribute 'name-of-attribute'
var start_region = 1;
var end_region = 10; // E.g. if my ee.FeatureCollection only has 10 features
// Load images
var image0 = ee.Image('XXX');
var image1 = ee.Image('XXX');
var image2 = ee.Image('XXX');
// Prepare image reclassification codes
var oldgroup = ee.List([0,10,11,12,20,21,22]);
var newgroup = ee.List([0,0,1,1,0,1,1]);
// Perform 'loop' operation
var i;
for (i=0;i<=2;i++){
// This creates an image stack
var imagestack = ee.List([image1,image2,image3]);
var year_dict = ee.Dictionary({
'0':'image1',
'1':'image2',
'2':'image3'
});
var year_string = year_dict.get(ee.Number(i).format()).getInfo();
var j;
for (j=start_region;j<=end_region;j++){
var region = boundary.filter(ee.Filter.eq('name-of-attribute', j));
var imagexregion = ee.Image(imagestack.get(i))
.clip(region).remap(oldgroup,newgroup);
var region_string = String(j);
Export.image.toDrive({
image:imagexregion.uint8(),
description:'esa-'+region_string+'-'+year_string, // This is the part you are asking about.
folder:'esa-loop-test',
region:region,
scale:300, // spatial resolution of my dataset
crs:'EPSG:4326',
maxPixels:1e13,
fileFormat:'GeoTIFF'});
}
}