Sorry, I incorrectly thought you want to power a device first from one supply, then a second supply.
I didn't realize you want current to go one way, then the other.
Going along with sky_123's post #6, this is a simple layout for charging and discharging a capacitor.
CLK (clock) is a repetitive signal that controls the action. A 555 IC would be a good choice for this (as sky_123 suggested).
First the PNP transistor turns on, while the NPN is off. Then the opposite occurs.
A resistor is in series with the capacitor, to limit current.
The power supply is labelled at the top. 5V can be changed to whatever you wish.