Make your initial selection (rectangle) and press the letter Q for entering Quick Mask Mode
Make a selection around the rectangle in Quick Mask.
Press Command-T (PC: Alt-control-T) for free transform.
Drag the selection the distance you want (hold down shift key to keep it along the same pane) and press enter.
Then press shift-alt-command-T (PC:Shift-Alt_Control_T) to repeat transformation, as many times you like. It is very important that you press these four keys for working.
Each rectangle will be spaced evenly. Press again Q to return to standard mode.
Now we create a new layer, inverse the selection and paint it White.

