Copy First N files from current directory to other directory

I was working today on one production issue where a requirement came to restore files from a archive directory in batch of 250, so i created this command to run in unix, have a look might be helpful for you.

$find . -maxdepth 1 -type f |head -250|xargs mv -t destDir

 will move first 250 files from current directory to destination dir

 

About nitingautam

I am Tech Lead (Java/J2EE/ExtJs) with a MNC located @ Gurgaon.
This entry was posted in unix and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *