目录

拷贝一批文本文件(10000)到目录

cp

  • time: 0.470s
  • 当文件更新了或者缺少时才拷贝。(-u)
  • 速度最快
    cp -u labels/*/*.txt datasets/yolo/sign/labels/
    

xargs

  • time: 30.003s
    ls labels/*/*.txt | xargs -I {} cp {} datasets/yolo/sign/labels/
    

find -exec

  • time: 32.521s
    find labels/ -type f -iname '*.txt' -exec cp {} datasets/yolo/sign/labels/ \;
    

for

  • time: 41.259s
    for i in `ls labels/*/*.txt`; do cp $i datasets/yolo/sign/labels/; done
    

参考资料