0

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?

  • Which 20,000 do you want to copy? – symcbean Aug 29 '11 at 11:26
1
for FILE in `find /your/directory ! -type d  | head -n 20000`; do cp $FILE /destination/dir/; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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