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/

上一篇:xargs 命令教程


下一篇:HTTP请求中返回文件