We describe the results of a sequence of simulations of gravitational collapse in a turbulent magnetized region. The parameters are chosen to be representative of molecular cloud material. We find that several protostellar cores and filamentary structures of higher than average density form. The filaments inter-connect the high density cores. Furthermore, the magnetic field strengths are found to correlate positively with the density, in agreement with recent observations. We make synthetic channel maps of the simulations and show that material accreting onto the cores is channelled along the magnetized filamentary structures. This is compared with recent observations of S106, and shown to be consistent with these data. We postulate that this mechanism of accretion along filaments may provide a means for molecular cloud cores to grow to the point where they become gravitationally unstable and collapse to form stars.