假設要移動特定檔名的檔案到某個資料匣,但是因為檔案數量太多出現以下錯誤訊息

[root@example testdir]# mv test-*.log /tmp/workdir/
-bash: /usr/bin/mv: Argument list too long

可以考慮 find 配合 xargs 實現
參考語法:
[root@example testdir]# /usr/bin/find /testdir/ -type f -name 'test-*.log' | /usr/bin/xargs  -I '{}' /usr/bin/mv '{}' /tmp/workdir/

arrow
arrow
    文章標籤
    find xargs linux
    全站熱搜
    創作者介紹
    創作者 helloworld 的頭像
    helloworld

    Hello World

    helloworld 發表在 痞客邦 留言(0) 人氣()