To automatically sell all items in your bag (except Key Items) in Pokémon Diamond, use the following Action Replay code. This requires an Action Replay device.
94000130 FCFF0000 B21E4D08 00000000
Activation: Press L + R simultaneously to trigger the effect.
Warning: Use cheat codes at your own risk; always back up your save file before applying codes.