Copying large number of files from one directory to another in linux

Posted by Ritesh Sharma on Super User See other posts from Super User or by Ritesh Sharma
Published on 2010-02-10T14:10:26Z Indexed on 2010/06/14 23:33 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

Hi all,

I've a directory containing around 2.8 lacs of files. I want to move them to another directory.

If I use 'cp' or 'mv' then I get an error 'argument list too long'.

If I write a script like

for file in ls *; do
   cp {source} to {destination} 
done

then because of 'ls' command , its performance degrades.

How can I do this?

© Super User or respective owner

Related posts about linux

Related posts about copy