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?
for FILE in `find /your/directory ! -type d | head -n 20000`; do cp $FILE /destination/dir/; done
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
4 years ago