I have a directory with almost 100,000 files inside. I want to copy 20,000 of them to another directory. Is it possible to do this with the cp command or is there any other way?

link|improve this question

64% accept rate
Which 20,000 do you want to copy? – symcbean Aug 29 '11 at 11:26
feedback

1 Answer

up vote 1 down vote accepted
for FILE in `find /your/directory ! -type d  | head -n 20000`; do cp $FILE /destination/dir/; done
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.