Learn N Try

For all Lean Enthusiast

Copy first 2000 files to other directory

Many times it is required to copy only n number of files from one directory to other directory so here is simple one line script to copy files. It will be useful during some testing.


for i in `ls /home/user/inputDir | head -2000`; do ; cp “/home/user/inputDir/$i” /var/opt/OutputDir ; done &

This script will copy 2000 files from /home/user/inputDir to the /var/opt/OutputDir