Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Delete File inside AWS S3 bucket path

avatar
New Contributor

Hi, I 'am trying to delete all the files that there are into the path from S3 Bucket. For example I have Buketname/Input_file and on this I have:
File1.txt
File2.txt
File2.txt
....
I need to delete all the files but not the bucket.
If I conect ListS3 process to DeleteS3Objet process I can delete all the files but it delete the path too.
If I connect ListS3 process --> FetchS3Object-->RouteonAttribute (to obtain the file name and discard the path that came as file name too using matched and not matched) -->DeleteS3Object to do the delete action. All the process work well and I don't have error but the files is not delete.
Could somebody tell me, how can resolve this issue?
There are some topic that talk about how delete the files in s3 but without delete the path?

Thanks

1 ACCEPTED SOLUTION

avatar
New Contributor

I was able to solve this problem.
I will sahre the way to delete the files that there are inside the specific path.
First I list the files as show in the first picture.

Delete S3 1.PNG
I had to set the bucket name, delimiter and prefix as shown in the second and third images.Delete S3 2.PNGDelete S3 3.PNG

The prefix is used to filter the files from the path.
(In this case
Buketname/To_Proccess/Input/
File1.txt
File2.txt
File3.txt
)

The delimeter is '/'

 

After that I use RouteOnAttribute and set it to filter the '/' as is showed in the picture:Delete S3 4.PNG


And the last step is configure DeleteS3Object process where only have to set the name of the bucket. In my case 'Bucketname'.

 

Delete S3 5.PNG

 

All these proccess delete File1.txt, File2.txt, File3.txt but not delete the path '/To_Proccess/Input/' inside the bucket.

View solution in original post

1 REPLY 1

avatar
New Contributor

I was able to solve this problem.
I will sahre the way to delete the files that there are inside the specific path.
First I list the files as show in the first picture.

Delete S3 1.PNG
I had to set the bucket name, delimiter and prefix as shown in the second and third images.Delete S3 2.PNGDelete S3 3.PNG

The prefix is used to filter the files from the path.
(In this case
Buketname/To_Proccess/Input/
File1.txt
File2.txt
File3.txt
)

The delimeter is '/'

 

After that I use RouteOnAttribute and set it to filter the '/' as is showed in the picture:Delete S3 4.PNG


And the last step is configure DeleteS3Object process where only have to set the name of the bucket. In my case 'Bucketname'.

 

Delete S3 5.PNG

 

All these proccess delete File1.txt, File2.txt, File3.txt but not delete the path '/To_Proccess/Input/' inside the bucket.