linux command - 拷贝某文件夹下,按名称排序后前n个文件

find ../ImageAll_V1_part1/mask/ -maxdepth 1 -type f | sort | head -n 40 | xargs cp -t ./

 https://askubuntu.com/questions/662339/sort-files-alphabetically-before-processing

https://unix.stackexchange.com/questions/29214/copy-first-n-files-in-a-different-directory

https://unix.stackexchange.com/questions/12976/how-to-move-100-files-from-a-folder-containing-thousands

 

using find with xargs:

https://shapeshed.com/unix-xargs/

posted @ 2021-09-04 10:30  imoon22  阅读(72)  评论(0编辑  收藏  举报