RGB sensor

Is it possible to upload programming in Arduino that detects a RGB sensor and turns clock-wise and anti-clockwise motion of motor if color detected is RED and vice-versa if color is GREEN along with delay, input and output pins?

I don't know how you would detect an RGB sensor. If what you really mean is to use an RGB sensor to detect a color then that is certainly doable. I bet if you search the web just a little you'll find several examples of doing that. As far as driving a motor based on some condition I know for certain that there are tens of thousands of examples of that.

You could even do it without delay (but with input and output pins.)

YOu could try a pair of these, one with a red filter and one with green. THe sensor has a range of blue to IR so should detect red and green.