2016-11-08 66 views
0

我有這個find命令,需要使其在當前目錄遞歸地工作(目前它搜索磁盤上的所有文件)如何使此查找命令在當前目錄中遞歸地工作?

find . -name ‘OldName*’ -print0 | xargs -0 rename -S ‘OldName’ ‘NewName’ 

任何想法如何使它在當前目錄中搜索該我在終端導航?

+0

'find .'表示僅遞歸搜索當前目錄...並且您不需要xargs,只需使用-exec ...請參閱https://unix.stackexchange.com/questions/321697/why -is-looping-over-finds-output-bad-practice and https://unix.stackexchange.com/questions/313819/add-file-extension-to-files-that-have-no-extension – Sundeep

+0

啊我沒有意識到謝謝Sundeep :) –

回答

0

這項工作?

find . -name 'OldName' -exec rename -n 'OldName' 'NewName' \; 
相關問題