Friday, July 15, 2016

OS X Terminal Recipes

Copy the first n files in a directory to a specified destination directory:
$ find . -maxdepth 1 -type f | head -1000 | xargs -I {} mv {} subs/01/


This script creates multiple sub directories, and copies n files to each sub directory:
for i in {1..20}
do
 echo $i
 mkdir $i
 find . -maxdepth 1 -type f | head -1000 | xargs -I {} mv {} $i/
done

2 comments:

  1. wow really superb you had posted one nice information through this. Definitely it will be useful for many people. So please keep update like this.

    Back to Original

    ReplyDelete
  2. Good blog post which provided a interesting information os-x-terminal.keep updating...
    SEO Companies in India

    ReplyDelete