We have a spring cloud data flow stream, which processes input files and produces output files in S3 bucket. We are using following key-expression property to specify the folder for the output file.
app.s3-sink-rabbit.s3.key-expression='XYZ/abc/'+headers.file_name
We are trying to add date in YYYYMMDD as folder for our output files. i.e. output location should be XYZ/abc/20230110/{filename}
We understood that folder gets created automatically in S3 if it is not found, while generating file. We could append date in YYYYMMDD and then '/' to the file name through program, but we want to know if it can be done through some expression in property.
I believe the following may do what you want:
app.s3-sink-rabbit.s3.key-expression='XYZ/abc/'+T(java.time.LocalDate).now().format(T(java.time.format.DateTimeFormatter).BASIC_ISO_DATE)+'/'+headers.file_name