Removing old files from AWS S3 when uploading


When I upload files to AWS S3 it keeps the old content there. I would like to clean the whole folder and then upload. In a nutshell, instead of a simple upload, I would like to have a sync operation.



@Gpx, have you added any files there before adding the pipeline?
If yes, make sure to remove them manually. Then, once you deploy from your repository, files will be added/deleted in accordance with the changesets.
If you have the deployment set from the filesystem, however, there’s no option to remove the files (the mechanism won’t work)


I see, thank you for the explanation.


@Octavia would it be possible to add a delete flag that removes content from S3 if it’s not present in the filesystem? The same thing AWS command line does with the --delete flag:

--delete (boolean) Files that exist in the destination but not in the source are deleted during sync. link

Right now, every time I deploy, new files get added to my bucket and the old ones are still in there. This feature would help keep things clean.


@Gpx, sorry for not replying earlier. I forwarded your request for further analysis, I’ll let you know as soon as I have any info.


+1 . Essential for web app CD . As Static files are deployed on CDN (S3)