We demonstrate that cosmic rays form filamentary structures in the precursors of supernova remnant shocks due to their self-generated magnetic fields. The cosmic ray filamentation results in the growth of a long-wavelength instability, and naturally couples the rapid non-linear amplification on small scales to larger length-scales. Hybrid magnetohydrodynamics-particle simulations are performed to confirm the effect. The resulting large-scale magnetic field may facilitate the scattering of high-energy cosmic rays as required to accelerate protons beyond the knee in the cosmic ray spectrum at supernova remnant shocks. Filamentation far upstream of the shock may also assist in the escape of cosmic rays from the accelerator.