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?

user9517
  • 115,471
  • 20
  • 215
  • 297
Willy
  • 225
  • 1
  • 5
  • 9

1 Answers1

1
for FILE in `find /your/directory ! -type d  | head -n 20000`; do cp $FILE /destination/dir/; done
HUB
  • 6,630
  • 3
  • 23
  • 22