Yes, however the can system would be small and take a long time to produce a decent amount of water. You want the layers not to leech over into other layers. Thin cotton cloth or cheesecloth can be cut to work with larger buckets.
But I’d start with a layer of good soil. Then small pea gravel. Then work into finer layers.
Periodically you need to change out the soil layer. Eventually you’ll need to redo all the layers.
If you wanted to make this more antibacterial some people make a layer of silver coins in between a couple fine sand layers.
I can’t help but remember how I grew up. My grandparents had a cistern made of stone all the way down in the ground. They caught rain water from the roof and filtered it through a flour sack. We never got sick or knew anything about bacteria in the water. There was an occasional little bug that resembled an earwig in the water, but we just threw him out of the dipper and drank the water. When it didn’t rain for a spell and the cistern went dry, Pa would hitch up the horses to the wagon, put the rain barrels on it, and drive a mile to the creek where there was a spring. We dipped spring water into the barrels and filled some water jugs for drinking. Life on a dry hillside was not easy, but joyful.