How to read first n-th files from directory (pleaso NOT a “head -n solution”)?
问题 I have a directory with more then 60000 files. How to get only N of them without using a find | head -n or ls | head -n solutions, since find and ls to read this list of files takes too much time. Are there any configs for ls and find or are there any other programs, which can help to safe the time? 回答1: For what it worth: # Create 60000 files sh$ for i in {0..100}; do for j in {0..600}; do touch $(printf "%05d" $(($i+$j*100))); done; done On Linux Debian Wheezy x86_64 w/ext4 file system: sh$